like if, you can use while as a statement modifier, at the end of a statement : while as Modifier « Statement « Ruby






like if, you can use while as a statement modifier, at the end of a statement


cash = 100_000.00
sum = 0

cash += 1.00 + sum while cash < 1_000_000.00 # underscores ignored

 








Related examples in the same category

1.Use while as a Loop Modifier