Add Lua code for chapter 5
This commit is contained in:
committed by
Aditya Bhargava
parent
5f2626c91b
commit
86785a0659
13
05_hash_tables/lua/02_check_voter.lua
Normal file
13
05_hash_tables/lua/02_check_voter.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
local voted = {}
|
||||
function check_voter(name)
|
||||
if voted[name] then
|
||||
print("kick them out!")
|
||||
else
|
||||
voted[name] = true
|
||||
print("let them vote!")
|
||||
end
|
||||
end
|
||||
|
||||
check_voter("tom")
|
||||
check_voter("mike")
|
||||
check_voter("mike")
|
||||
Reference in New Issue
Block a user