* 01_binary_search Swift 3.0.2 * 01_binary_search Swift 3.0.2 * add Chapter 2 - 01_selection_sort Swift 3.0.2 example * 01_binary_search cosmetic note updates Swift 3.0.2 * 03_recursion Swift 3.0.2 examples * 04_quicksort Swift 3.0.2 examples * fix typo on quicksort example. Swift 3.0.2 * add 05_hash_tables examples on Swift 3.0.2 * add 01_breadth-first_search Swift 3.0.2 example * 01_breadth-first_search fixing typo Swift 3.0.2 * add 01_dijkstras_algorithm on Swift 3.0.2 * add 08_greedy_algorithms Swift 3.0.2 example * 01_longest_common_subsequence Swift 3.0.2 example
19 lines
284 B
Swift
19 lines
284 B
Swift
import Foundation
|
|
|
|
var voter = [String : Bool]()
|
|
|
|
func checkVoter(_ name : String) {
|
|
if voter[name] != nil {
|
|
print("kick them out!")
|
|
} else {
|
|
voter[name] = true
|
|
print("let them vote!")
|
|
}
|
|
}
|
|
|
|
checkVoter("tom")
|
|
checkVoter("mike")
|
|
checkVoter("mike")
|
|
|
|
|