learn_ruby_ch3_pt3 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Unless statement (lang “de”)

A
unless lang == "de"
  dog = "dog"
else
  dog = "Hund"
end
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Until statement (weight)

A
weight = 150
until weight == 200 do
  puts "Weight: " + weight.to_s
  weight += 5
end
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

begin until statement (weight)

A

weight = 150

begin
puts “Weight: “ + weight.to_s
weight += 5
end until weight == 200

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

until as statement modifier (age)

A

age = 1
puts age += 1 until age > 28

prints 2 through 28

How well did you know this?
1
Not at all
2
3
4
5
Perfectly