Files
grokking_algorithms/05_hash_tables/kotlin/02_check_voter.kt
NikitaLipatov 64a09d6584 05 & 06 exercises (#114)
Co-authored-by: Aditya Bhargava <bluemangroupie@gmail.com>
2022-11-18 14:34:48 -06:00

19 lines
363 B
Kotlin

val voted:HashMap<String,Boolean> = HashMap<String, Boolean>()
fun checkVoter(name: String) {
if(!voted.containsKey(name)){
voted.put(name, true)
println("let them vote!")
} else {
println("kick them out!")
}
}
fun main(args: Array<String>) {
checkVoter("tom")
checkVoter("mike")
checkVoter("mike")
}