mirror of
https://github.com/chubin/cheat.sheets
synced 2024-11-19 03:25:44 +00:00
[ruby] merge if/else with if/elsif/else
No need to add extra lines to the output. Shorter is better :)
This commit is contained in:
parent
ed061663ba
commit
4cabda0a56
@ -22,13 +22,7 @@ end
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Conditionals
|
# Conditionals
|
||||||
if 2 * 4 == 8
|
|
||||||
puts 'thank goodness'
|
|
||||||
else
|
|
||||||
puts 'error between keyboard and chair'
|
|
||||||
end
|
|
||||||
|
|
||||||
# Add an extra condition
|
|
||||||
if 1 == 0
|
if 1 == 0
|
||||||
puts 'oh no'
|
puts 'oh no'
|
||||||
elsif 1 == 1
|
elsif 1 == 1
|
||||||
|
Loading…
Reference in New Issue
Block a user