fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.
Fuzion
•
Idioms
•
Idiom # 78: do while loop
Idiom # 78: do while loop
See
programming-idioms.org
:
Code
do some_thing until !c
What are effects?
Running Example
ex78 is # let's print the 3x+1 sequence starting at 27 # (see https://mathworld.wolfram.com/CollatzProblem.html): # start := 27 _ := for n in 1.. x := start, if x %% 2 then x/2 else 3*x+1 mx := x, max mx x do say "$n: $x {if x=mx then "new max" else ""}" until x <= 1 say "total $n steps, maximum reached was $mx"
What are effects?
last changed: 2024-07-01
next: Idiom # 79: Convert integer to floating point number