unless and until : until « Statement « Ruby






unless and until


An unless statement is really like a negated if statement

if lang == "de"
  dog = "Hund"
else
  dog = "dog"
end

# Now I'll translate it into unless:

unless lang == "de"
  dog = "dog"
else
  dog = "Hund"
end

 








Related examples in the same category

1.Here's the formal specification for the until loop:
2.until keeps looping while its condition remains false, or not true.
3.As unless is a negated form of if, until is really a negated form of while.
4.like while, you have another form you can use with untila€¡±that is, with begin/end:
5.until loops until a certain condition is met