learn_ruby_ch3_pt3 Flashcards
1
Q
Unless statement (lang “de”)
A
unless lang == "de" dog = "dog" else dog = "Hund" end
2
Q
Unless as a statement modifier (age)
A
age = 10
puts age += 1 unless age > 29 # 11
age = 31
puts age += 1 unless age > 29 # no output
3
Q
Until statement (weight)
A
weight = 150 until weight == 200 do puts "Weight: " + weight.to_s weight += 5 end
4
Q
begin until statement (weight)
A
weight = 150
begin
puts “Weight: “ + weight.to_s
weight += 5
end until weight == 200
5
Q
until as statement modifier (age)
A
age = 1
puts age += 1 until age > 28
prints 2 through 28