Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Choose between Option 1 and Option 2")
- choice = io.read()
- -- validate the user input
- while choice ~= "Option 1" and choice ~= "Option 2" do
- print("Invalid choice. Choose between Option 1 and Option 2")
- choice = io.read()
- end
- -- generate a random number between 1 and 2
- if math.random(1, 2) == 1 then
- print("You chose " .. choice .. ". Option 2 was not selected.")
- else
- print("You chose " .. choice .. ". Option 1 was not selected.")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement