13 lines
315 B
Scala
13 lines
315 B
Scala
import scala.collection.mutable
|
|
val voted = mutable.Map[String, Boolean]()
|
|
def check_voter(name: String): Unit = {
|
|
if(voted.exists(_ == (name,true))){
|
|
println("kick them out!")
|
|
} else{
|
|
voted += (name -> true)
|
|
println("let them vote!")
|
|
}
|
|
}
|
|
check_voter("tom")
|
|
check_voter("mike")
|
|
check_voter("mike") |