조건문
조건문
if/else/elsif/end
if/else/elsif/endif x < y # Assumes x and y are defined
puts "x is less than y!"
elsif x > y
puts "x is greater than y!"
else
puts "x equals y!"
endexpression if booleanunless/else/end
unless/else/endunless hungry
# Write some
else
# Have some noms
endexpression unless booleancase/when/else/end
case/when/else/endternary conditional expression
Comparators
relational operator
==와=의 차이점==는 같다는 표현으로 비교를 할 때 사용된다.=는 대입을 할 때 사용된다.!=: not equal<: less than<=: less than or equal to>: greater than>=: greater than or equal to
logical operator
&&: and (둘다 true 이면 true)||: or (둘중 하나만 true 이면 true)!: not (반대)
Last updated
Was this helpful?