zaagan
1/27/2020 - 3:53 PM

Ruby Basics - If Else Operators

Ruby Basics - If Else Operators

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