Files
grokking_algorithms/05_hash_tables/golang/02_check_voter.go
Renan Duarte Leal 1d5567fe9a Update 02_check_voter.go (#288)
fix voting status
2024-12-07 07:30:04 -06:00

22 lines
315 B
Go

package main
import "fmt"
var voted map[string]bool
func main() {
voted = make(map[string]bool)
check_voter("tom")
check_voter("mike")
check_voter("mike")
}
func check_voter(name string) {
if voted[name] {
fmt.Println("kick them out!")
} else {
voted[name] = true
fmt.Println("let them vote!")
}
}