Ruby has a wealth of conditional constructs, including if
/unless
, while
/until
etc.
The while
block from C
while (condition) {
...
}
can be directly translated to Ruby:
while condition
...
end
However, I can't seem to find a built-in equivalent in Ruby for a C-like do ... while
block (in which the block contents are executed at least once):
do {
...
} while (condition);
Any suggestions?