Loops/Do-while: Difference between revisions

m (→‎{{header|Emacs Lisp}}: Fix unclosed markup)
Line 912:
</lang>
 
=={{header|F_Sharp|F#}}==
If you must have a loop then this is acceptable F#
<lang fsharp>
Line 935:
4
5
</pre>
 
Many of the solutions to this task show no output in spite of it being required in the task dexcription, so who knows what they do? Of some that have output they think it should be 1 to 6, who can tell from the task description? The following produces 1..6.
 
<lang fsharp>
// Loops/Do-while. Nigel Galloway: February 14th., 2022
Seq.unfold(fun n->match n with Some n->let n=n+1 in Some(n,if n%6=0 then None else Some(n)) |_->None)(Some 0)|>Seq.iter(printfn "%d")
</lang>
{{out}}
<pre>
 
1
2
3
4
5
6
</pre>
 
2,172

edits