Loops/While: Difference between revisions

Content added Content deleted
(Add lang example)
(Merge duplicated example for Lambdatalk)
Line 1,928: Line 1,928:
</syntaxhighlight>
</syntaxhighlight>


Alternative solution:
=={{header|Lang}}==
<syntaxhighlight lang="lang">
$n = 1024
while($n > 0) {
fn.println($n)
$n //= 2
}
</syntaxhighlight>

=={{header|Lang5}}==
{{trans|Factor}}
<syntaxhighlight lang="lang5">: /i / int ; : 0= 0 == ;
: dip swap '_ set execute _ ; : dupd 'dup dip ;
: 2dip swap '_x set swap '_y set execute _y _x ;
: while
do dupd 'execute 2dip
rot 0= if break else dup 2dip then
loop ;

1024 "dup 0 >" "dup . 2 /i" while</syntaxhighlight>

=={{header|Lambdatalk}}==
<syntaxhighlight lang="scheme">
<syntaxhighlight lang="scheme">
{def while
{def while
Line 1,972: Line 1,950:
1
1
</syntaxhighlight>
</syntaxhighlight>

=={{header|Lang}}==
<syntaxhighlight lang="lang">
$n = 1024
while($n > 0) {
fn.println($n)
$n //= 2
}
</syntaxhighlight>

=={{header|Lang5}}==
{{trans|Factor}}
<syntaxhighlight lang="lang5">: /i / int ; : 0= 0 == ;
: dip swap '_ set execute _ ; : dupd 'dup dip ;
: 2dip swap '_x set swap '_y set execute _y _x ;
: while
do dupd 'execute 2dip
rot 0= if break else dup 2dip then
loop ;

1024 "dup 0 >" "dup . 2 /i" while</syntaxhighlight>


=={{header|langur}}==
=={{header|langur}}==