Files
grokking_algorithms/05_hash_tables/kotlin/02_check_voter.kt
bigpas 6b9faa9cab fix: naming convention. Min. refactor (#116)
* fix: naming convention. Min. refactor

* add: 05 for Kotlin
2019-11-12 09:18:17 -06:00

20 lines
364 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")
}