if customerName =="Fred"print"Hello Fred!"elsif customerName =="John"print"Hello John!"elsif customername =="Robert"print"Hello Bob!"end
Switch
result =case valuewhen match1 then result1when match2 then result2when match3 then result3when match4 then result4when match5 then result5when match6 then result6else result7end###score =70result =case scorewhen0..40then"Fail"when41..60then"Pass"when61..70then"Pass with Merit"when71..100then"Pass with Distinction"else"Invalid Score"endputs result
Loops
While
while expression do... ruby code here ...breakif i ==2end
Unless & Until
# 1i =0until i ==5puts i i +=1end# 2puts i +=1until i ==5
unless — это обратная история if
unless i >=10puts"Student failed"elseputs"Student passed"end
For
# 1for i in1..8doputs ibreakif i ==2end# 2for i in1..8doputs i end