score = 85
if score >= 90
puts "A"
elsif score >= 80
puts "B"
else
puts "C"
endFor one-liners, you can put the condition after the statement:
puts "big" if score >= 90
x = 42 if readyif x > 0 && x < 100
puts "in range"
end
if name == "admin" || name == "root"
puts "superuser"
end
if !done
puts "still working"
endOperators: ==, !=, <, >, <=, >=, &&, ||, !
Like Ruby, || returns the first truthy value and && returns the last truthy value (or the first falsy one). This makes || great for defaults:
name = input || "anonymous"
config = load_config() || {}i = 0
while i < 5
puts i
i += 1
endNext: For Loops