Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 2 ways to use unless keyword - opposite of if expression
- hungry = false
- unless hungry #check if something is false
- puts "I'm writing Ruby programs!" #when not hungry (ie. false)
- else
- puts "Time to eat!" #when hungry (ie. true)
- end # always end the loop
- problem = false
- print "Good to go!" unless problem # statement will be printed since problem is false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement