Created
January 27, 2020 15:53
-
-
Save zaagan/dbb8a9c0d189daf27cde06e70b080901 to your computer and use it in GitHub Desktop.
Ruby Basics - If Else Operators
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cond1 = cond3 = true | |
cond2 = cond4 = false | |
if cond1 and cond3 then puts "1" end | |
if cond1 and not cond3 then puts "2" end | |
if cond1 or cond2 then puts '3' end | |
if cond1 && cond3 then puts '1' end | |
if cond1 && !cond3 then puts '2' end | |
if cond1 || cond2 then puts '3' end | |
if (cond1 && cond3) or not (cond2 || cond4) then puts '4' end | |
if 'string' == 'string' then puts '5' end | |
if 'string' != 'string' then puts '6' end | |
# 1 | |
# 3 | |
# 1 | |
# 3 | |
# 4 | |
# 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment