* Add files via upload * Update 01_countdown.scala * Update 02_greet.scala * Update 02_greet.scala * Create scala * Delete scala * Add files via upload * Add files via upload
12 lines
285 B
Scala
12 lines
285 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)
|
|
}
|
|
}
|
|
check_voter("tom")
|
|
check_voter("mike")
|
|
check_voter("mike") |