while (true) {
   System.out.println("SPAM");
}


DEFINE loop == [true []] dip while.

["SPAM\n" putchars] loop.


for i in range(1, 10)
   echon i
   if (i != 10)
      echon ", "
   endif
endfor


For i = 1 To 10
    Console.Write(i)
    If i = 10 Then Exit For
    Console.Write(", ")
Next


fn main() {
    for i := 1; ; i++ {
        print(i)
        if i == 10 {
            break
        }
        print(", ")
    }
}


print 1 ""
for numbers=1 to 10
print 1 at numbers*3-2,0 numbers
if numbers<>10
print 1 at numbers*3-1,0 ","
endif
end


begin
    integer i;
    for i:=5 step 5 until 25 do outint(i, 5)
end


2 to: 8 by: 2 do: [| :i | Console ; i printString ; ', '].
inform: 'enough with the cheering already!'.


2 to: 8 by: 2 do: [ :i |
  Transcript show: i; show ', '
].
Transcript showCr: 'enough with the cheering already!'


con
  _clkmode = xtal1 + pll16x
  _clkfreq = 80_000_000

obj
  ser : "FullDuplexSerial.spin"

pub main | n
  ser.start(31, 30, 0, 115200)

  repeat n from 0 to 19 step 3
    ser.dec(n)
    ser.tx(32)

  waitcnt(_clkfreq + cnt)
  ser.stop
  cogstop(0)


import "random" for Random
import "/fmt" for Fmt

var rand = Random.new()

var a = List.filled(20, null)
for (i in 0..19) {
    a[i] = List.filled(20, 0)
    for (j in 0..19) a[i][j] = rand.int(1, 21)
}

var found = false
for (i in 0..19) {
    for (j in 0..19) {
        System.write(Fmt.d(4, a[i][j]))
        if (a[i][j] == 20) {
            found = true
            break
        }
    }
    System.print()
    if (found) break
}


PROGRAM "loopsnested"

IMPORT "xst" ' for XstGetSystemTime

DECLARE FUNCTION Entry()

' Pseudo-random number generator
' Based on the rand, srand functions from Kernighan & Ritchie's book
' 'The C Programming Language'
DECLARE FUNCTION Rand()
DECLARE FUNCTION SRand(seed%%)

FUNCTION Entry()
  DIM array%[10, 10]
  XstGetSystemTime (@msec)
  SRand(INT(msec) MOD 32768)
  FOR row% = 0 TO 10
    FOR col% = 0 TO 10
      array%[row%, col%] = INT(Rand() / 32768.0 * 20.0) + 1
    NEXT col%
  NEXT row%

  isFound% = $$FALSE
  FOR row% = 0 TO 10
    PRINT "Row:"; row%
    FOR col% = 0 TO 10
      PRINT " Col:"; col%; ", value:"; array%[row%, col%]
      IF array%[row%, col%] = 20 THEN
        isFound% = $$TRUE
        EXIT FOR
      END IF
    NEXT col%
    IFT isFound% THEN
      EXIT FOR
    END IF
  NEXT row%
END FUNCTION

' Return pseudo-random integer on 0..32767
FUNCTION Rand()
  #next&& = #next&& * 1103515245 + 12345
END FUNCTION USHORT(#next&& / 65536) MOD 32768

' Set seed for Rand()
FUNCTION SRand(seed%%)
  #next&& = seed%%
END FUNCTION

END PROGRAM


for (i in 1..10) {
    System.write(i)
    System.write((i < 10) ? ", " : "\n")
}


PROGRAM "n_plus_one_half"

DECLARE FUNCTION Entry()

FUNCTION Entry()
  FOR i% = 1 TO 10
    PRINT i%;
    IF i% = 10 THEN EXIT FOR
    PRINT ",";
  NEXT i%
  PRINT
  ' If equality checking affected the efficiency
  ' or if the last value were treated in different manner,
  ' one would extract the last iteration:
  FOR i% = 1 TO 9
    PRINT i%; ",";
  NEXT i%
  PRINT 10
END FUNCTION
END PROGRAM


codes CrLf=9, IntOut=11, Text=12;
int  N;
[for N:= 1 to 10 do     \best way to do this
        [IntOut(0, N);  if N#10 then Text(0, ", ")];
CrLf(0);

N:= 1;                  \way suggested by task statement
loop    [IntOut(0, N);
        if N=10 then quit;
        Text(0, ", ");
        N:= N+1;
        ];
CrLf(0);
]


for i = 1 to 10
  print i;
  if i < 10 then print ", "; : endif
next i
print

end


forvalues i=1(2)10 {
	display "`i'"
}

1
3
5
7
9


for i in stride(from: 1, to: 10, by: 2) {
  print(i)
}


for {set i 2} {$i <= 8} {incr i 2} {
    puts -nonewline "$i, "
}
puts "enough with the cheering already!"


include c:\cxpl\codes;                  \intrinsic 'code' declarations
def  Size=10;

proc Nest(A);   \Display 2-dimensional array A contents until 20 is found
int  A;
int  I, J, K;
[for J:= 0 to Size-1 do
    for I:= 0 to Size-1 do
        [K:= A(I,J);
        IntOut(0, K);  ChOut(0, ^ );
        if K = 20 then return;          \there is no 'goto' instruction
        ];
]; \Nest

proc Fill(A);   \Fill 2-dimensional array A with random numbers 1..20
int  A;
int  I, J;
[for J:= 0 to Size-1 do
    for I:= 0 to Size-1 do
        A(I,J):= Ran(20)+1;
]; \Fill

int Array(Size,Size);
[Fill(Array);
 Nest(Array);
]


const N=5;
var rows=(0).pump(N,List, (0).pump.fp(N,List,(1).random.fpM("1-",21)) );
try{
   foreach r in (N){
      foreach c in (N){
         x:=rows[r][c]; x.print(",");
         if (x==20) { println("Found it!"); throw(Exception.Generic); }
      }
   }
   println("Not found");
}catch(Generic){}


10 DIM a(10,10)
20 FOR i=1 TO 10: FOR j=1 TO 10
30 LET a(i,j)=INT (RND*20)+1
40 NEXT j: NEXT i
50 LET b=0: REM flag to abort loops
60 FOR i=1 TO 10: FOR j=1 TO 10
70 PRINT (" " AND a(i,j)<10);a(i,j);" ";
80 IF a(i,j)=20 THEN LET i=10: LET j=10: LET b=1: REM abort loops
90 NEXT j
100 IF b=0 THEN PRINT
110 NEXT i
120 STOP


// version 1.0.6

fun main(args: Array<String>) {
    while (true) println("SPAM")
}


{def loops_infinite
 {lambda {}
  {if true then SPAM{br} {loops_infinite} else never}}}
-> loops_infinite

{loops_infinite}
-> SPAM forever...


const std = @import("std");
pub fn main() !void {
    const stdout_wr = std.io.getStdOut().writer();
    var i: u8 = 1;
    while (i <= 10) : (i += 1) {
        try stdout_wr.print("{d}", .{i});
        if (i == 10) {
            try stdout_wr.writeAll("\n");
        } else {
            try stdout_wr.writeAll(", ");
        }
    }
}


$$ MODE TUSCRIPT
LOOP i=2,9,2
PRINT i
ENDLOOP


x=2
while test $x -le 8; do
        echo $x
        x=`expr $x + 2` || exit $?
done


decl int i
for (set i 2) (< i 9) (set i (int (+ i 2)))
	out i ", " console
end for
out "who do we appreciate?" endl console


for (int i = 1; i < 10; i += 2)
  stdout.printf("%d\n", i);


// not wise to run this!
while(1 > 0) => {^
	'SPAM\r'
^}


repeat while TRUE
  put "SPAM"
end repeat


V things = [‘Apple’, ‘Banana’, ‘Coconut’]

L(thing) things
   print(thing)


Sub MyLoop()
    For i = 2 To 8 Step 2
        Debug.Print i;
    Next i
    Debug.Print
End Sub


buffer = ""
For i = 2 To 8 Step 2
    buffer = buffer & i & " "
Next
WScript.Echo buffer


module main;
  integer  i;

  initial begin

    for(i = 1; i <= 21; i = i + 2)  $write(i);
  $finish ;
  end
endmodule


repeat forever
  put "SPAM" & return
end repeat


HAI
  CAN HAS STDIO?
  IM IN YR LOOP
    VISIBLE "SPAM"
  IM OUTTA YR LOOP
KTHXBYE


(defun print-list (xs)
   (if (endp xs)
       nil
       (prog2$ (cw "~x0~%" (first xs))
               (print-list (rest xs)))))


PROC Main()
  DEFINE PTR="CARD"
  BYTE i
  PTR ARRAY items(10)
  items(0)="First"   items(1)="Second"
  items(2)="Third"   items(3)="Fourth"
  items(4)="Fifth"   items(5)="Sixth"
  items(6)="Seventh" items(7)="Eighth"
  items(8)="Ninth"   items(9)="Tenth"

  PrintE("In Action! there is no for-each loop")
  PutE()
  FOR i=0 TO 9
  DO
    PrintE(items(i))
  OD
RETURN


with Ada.Integer_Text_IO;
use  Ada.Integer_Text_IO;

procedure For_Each is

   A : array (1..5) of Integer := (-1, 0, 1, 2, 3);

begin

   for Num in A'Range loop
      Put( A (Num) );
   end loop;

end For_Each;


for i in range(2, 10, 2)
    echo i
endfor


for i := 1; i<10; i+=2 {
    println(i)
}


// Print odd numbers under 20.
for (i in 1..10) {
    var j = 2*i - 1
    System.write("%(j) ")
}

System.print("\n")

// Do the same using a 'while' loop.
var k = 1
while (k < 20) {
    System.write("%(k) ")
    k = k + 2
}
System.print()


while true do
  print("SPAM")
end

--Another solution
repeat
  print("SPAM")
until false


Module CheckIt {
      Print "SPAM"
      loop
}
Checkit


var str = "hello world"
foreach ch str {    // you can also use an optional 'in'
    println (ch)   // one character at a time
}


# iterate over a list of integers
integer i, v;

for (i, v in list(2, 3, 5, 7, 11, 13, 17, 18)) {
}


[]UNION(STRING, INT, PROC(REF FILE)VOID) collection = ("Mary","Had",1,"little","lamb.",new line);

FOR index FROM LWB collection TO UPB collection DO
  print((collection[index]," "))
OD


include c:\cxpl\codes;
int I;
[for I:= 2 to 8 do
        [IntOut(0, I);  Text(0, ", ");
        I:= I+1;
        ];
Text(0, "who do we appreciate?");
]


foreach n in ([1..10,4]) {println(n)}
[1..10,3].pump(Console.println)


const std = @import("std");

pub fn main() !void {
    const stdout_wr = std.io.getStdOut().writer();
    var i: u8 = 1;
    while (i < 10) : (i += 2)
        try stdout_wr.print("{d}\n", .{i});
}


While[True,
 [email protected]"SPAM";
 ]


PROC main()
  DEF a_list : PTR TO LONG, a
  a_list := [10, 12, 14]
  FOR a := 0 TO ListLen(a_list)-1
    WriteF('\d\n', a_list[a])
  ENDFOR
  -> if the "action" fits a single statement, we can do instead
  ForAll({a}, a_list, `WriteF('\d\n', a))
ENDPROC


Integer[] myInts = new Integer[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

for (Integer i : myInts) {
    System.debug(i);
}


repeat with fruit in {"Apple", "Orange", "Banana"}
  log contents of fruit
end repeat


While "True"
  TextWindow.WriteLine("SPAM")
EndWhile


arr: ["one" "two" "three"]

dict: #[
    name:		"John"
	surname:	"Doe"
	age:		34
]

loop arr 'item ->
    print item

loop dict [key val]->
    print [key "=>" val]


string = mary,had,a,little,lamb
Loop, Parse, string, `,
  MsgBox %A_LoopField%


BEGIN {
  split("Mary had a little lamb", strs, " ")
  for(el in strs) {
    print strs[el]
  }
}


LOOP
  InOut.WriteString ("SPAM");
  InOut.WriteLn
END;


OPTION COLLAPSE TRUE
FOR x$ IN "Hello cruel world"
    PRINT x$
NEXT

FOR y$ IN "1,2,\"3,4\",5" STEP ","
    PRINT y$
NEXT


@echo off
for %%A in (This is a sample collection) do (
     echo %%A
)


while (1)
  player:tell("SPAM");
endwhile


  ( list
  =   Afrikaans
      Ελληνικά
      עברית
      മലയാളം
      ئۇيغۇرچە
  )


#include <stdio.h>
...

const char *list[] = {"Red","Green","Blue","Black","White"};
#define LIST_SIZE (sizeof(list)/sizeof(list[0]))

int ix;
for(ix=0; ix<LIST_SIZE; ix++) {
   printf("%s\n", list[ix]);
}


string[] things = {"Apple", "Banana", "Coconut"};

foreach (string thing in things)
{
    Console.WriteLine(thing);
}


/* NetRexx */
options replace format comments java crossref savelog symbols nobinary

  say
  say 'Loops/Infinite'

  loop label spam forever
    say 'SPAM'
    end spam


10 FOR I=0 TO 1 STEP 0
20 PRINT "SPAM"
30 NEXT


MODULE InfiniteLoop;
IMPORT
  Out;
BEGIN
  LOOP
    Out.String("SPAM");Out.Ln
  END
END InfiniteLoop.


for (container_type::iterator i = container.begin(); i != container.end(); ++i)
{
  std::cout << *i << "\n";
}


var food = ["Milk", "Bread", "Butter"];
for f in food do writeln(f);


(doseq [item collection] (println item))


while true do
  print_endline "SPAM"
done


#USE "course.lib"
PROC main (CHAN BYTE screen!)
  WHILE TRUE
    out.string("SPAM*c*n", 0, screen)
:


start_up = proc ()
    po: stream := stream$primary_output()

    words: array[string] := array[string]$
        ["enemy", "lasagna", "robust", "below", "wax"]

    for word: string in array[string]$elements(words) do
        stream$putl(po, word)
    end
end start_up


set(list one.c two.c three.c)

foreach(file ${list})
  message(${file})
endforeach(file)


01  things occurs 3.
...
set content of things to ("Apple", "Banana", "Coconut")
perform varying thing as string through things
    display thing
end-perform


(let loop ()
   (display "SPAM")
   (loop))


PROC main:
  LOCAL loop%
  loop%=1
  while loop%=1
  PRINT "SPAM"
  ENDWH
ENDP


<Cfloop list="Fee, Fi, Foe, Fum" index="i">
  <Cfoutput>#i#!</Cfoutput>
</Cfloop>


import std.stdio: writeln;

void main() {
    auto collection1 = "ABC";
    foreach (element; collection1)
        writeln(element);

    auto collection2 = [1, 2, 3];
    foreach (element; collection1)
        writeln(element);

    auto collection3 = [1:10, 2:20, 3:30];
    foreach (element; collection3)
        writeln(element);

    foreach (key, value; collection3)
        writeln(key, " ", value);
}


while true do
    puts(1,"SPAM\n")
end while


items = { 1, 2, 3 }
for( item in items ) io.writeln( item )


program LoopForEach;

{$APPTYPE CONSOLE}

var
  s: string;
begin
  for s in 'Hello' do
    Writeln(s);
end.


do forever;
   put list ('SPAM'); put skip;
end;


To run:
Start up.
Write SPAM forever.
Shut down.

To write SPAM forever:
Write "SPAM" to the console.
Repeat.


for e in theCollection {
    println(e)
}


(define my-list '( albert simon antoinette))
(for ((h my-list)) (write h))
    albert simon antoinette

(define my-vector #(55 66 soixante-dix-sept))
(for (( u my-vector)) (write u))
    55 66 soixante-dix-sept

(define my-string "Longtemps")
(for ((une-lettre my-string)) (write une-lettre))
    "L" "o" "n" "g" "t" "e" "m" "p" "s"

;; etc ... for other collections like Streams, Hashes, Graphs, ...


while true do
    printf('SPAM', '%p\n');
endwhile;


across my_list as ic loop print (ic.item) end


open monad io

each [] = do return ()
each (x::xs) = do
  putStrLn $ show x
  each xs


import system'routines;
import extensions;

public program()
{
    var things := new string[]{"Apple", "Banana", "Coconut"};

    things.forEach:(thing)
    {
        console.printLine:thing
    }
}


#N canvas 426 88 450 300 10;
#X obj 17 75 print;
#X msg 17 55 SPAM;
#X obj 17 35 metro 1;
#X msg 17 15 1;
#X connect 1 0 0 0;
#X connect 2 0 1 0;
#X connect 3 0 2 0;


(dolist (x '(1 2 3 4))
  (message "x=%d" x))


      FOR INDEX$=("The","quick","brown","fox","jumps","over","the","lazy","dog.") DO
        PRINT(INDEX$;" ";)
      END FOR
      PRINT


#lang racket

;; Using recursion
(define (loop)
  (displayln "SPAM")
  (loop))

(loop)

;; Using a for loop
(for ([i (in-naturals)])
  (displayln "SPAM"))


include std/console.e

sequence s = {-2,-1,0,1,2}  --print elements of a numerical list
for i = 1 to length(s) do
	? s[i]
end for

puts(1,'\n')

s = {"Name","Date","Field1","Field2"} -- print elements of a list of 'strings'
for i = 1 to length(s) do
	printf(1,"%s\n",{s[i]})
end for

puts(1,'\n')

for i = 1 to length(s) do  -- print subelements of elements of a list of 'strings'
	for j = 1 to length(s[i]) do
		printf(1,"%s\n",s[i][j])
	end for
	puts(1,'\n')
end for

if getc(0) then end if


for i in [1 .. 10] do printfn "%d" i

List.iter (fun i -> printfn "%d" i) [1 .. 10]


/*REXX program displays the  word      SPAM      forever.               */

  do forever
  say 'SPAM'
  end   /*DO forever*/
                                       /*control will never reach here. */
                                       /*don't stick a fork in it.      */


: "infinite_loop"
* "SPAM"
goto "infinite_loop"


[loop] print "Spam" :goto [loop]

while 1
print "Spam"
wend


class Main
{
  public static Void main ()
  {
    Int[] collection := [1, 2, 3, 4, 5]
    collection.each |Int item|
    {
      echo (item)
    }
  }
}


(each [k v (ipairs [:apple :banana :orange])]
  (print k v))


create a 3 , 2 , 1 ,
: .array ( a len -- )
  cells bounds do  i @ .  cell +loop ;     \ 3 2 1


fn main() {
    loop {
        println!("SPAM");
    }
}


class MAIN is
  main is
    loop
      #OUT + "Spam\n";
    end;
  end;
end;


program main

 implicit none

 integer :: i
 character(len=5),dimension(5),parameter :: colors = ['Red  ','Green','Blue ','Black','White']

 !using a do loop:
 do i=1,size(colors)
   write(*,'(A)') colors(i)
 end do

 !this will also print each element:
 write(*,'(A)') colors

end program main


for path in $PATH
    echo You have $path in PATH.
end


array = [1, 2, 3, 5, 7]
for n = array
   println[n]


((lambda (x) (display "SPAM") (newline) (x x))
 (lambda (x) (display "SPAM") (newline) (x x)))


$ include "seed7_05.s7i";

const proc: main is func
  begin
    while TRUE do
      writeln("SPAM");
    end while;
  end func;


func printAll(values []int) {
   for i, x := range values {
      fmt.Printf("Item %d = %d\n", i, x)
   }
}


def beatles = ["John", "Paul", "George", "Ringo"]

for(name in beatles) {
    println name
}


$things = ["Apple", "Banana", "Coconut"];

foreach ($things as $thing) {
    echo $thing;
}


[
    Transcript showCR:'boring stuff'.
] loop

[true] whileTrue:[
    Transcript showCR:'also borinh'.
]

[
    Transcript showCR:'poor cpu'.
] doUntil:[false]

[
    Transcript showCR:'please press CTRL-c!'.
] doWhile:[true]


@\>@\>@\>@\>++++++++++===!/ < < < < \
 |  |  |  \[email protected]@@@[email protected]+++++# \.>.>.>.>./
 |  |  \[email protected]@[email protected]@@@+++#
 |  \[email protected]@[email protected]@[email protected]@+++#
 \[email protected]@[email protected][email protected]@@+++#


import Control.Monad (forM_)
forM_ collect print


var a = [1, 2, 3, 4];

for (i in a)
  Sys.println(i);


CHARACTER days="Monday Tuesday Wednesday Thursday Friday Saturday Sunday "

items = INDEX(days, ' ', 256)          ! 256 = count option
DO j = 1, items
  EDIT(Text=days, ITeM=j, Parse=today)
  WRITE() today
ENDDO


con
  _clkmode = xtal1 + pll16x
  _clkfreq = 80_000_000

obj
  ser : "FullDuplexSerial.spin"

pub main
  ser.start(31, 30, 0, 115200)

  repeat
    ser.str(string("SPAM",13,10))

  waitcnt(_clkfreq + cnt)
  ser.stop
  cogstop(0)


--#SET TERMINATOR @

SET SERVEROUTPUT ON@

BEGIN
 DECLARE I SMALLINT DEFAULT 1;
 WHILE (I = I) DO
  CALL DBMS_OUTPUT.PUT_LINE('SPAM');
 END WHILE;
END @


procedure main()
X := [1,2,3,-5,6,9]
every x := !L do
   write(x)
end


program main;
  initial forever $display("SPAM");
endprogram


while true {
    puts SPAM
}
# or
for {} 1 {} {
    puts SPAM
}


Iterable<Type> collect;
...
for(Type i:collect){
   System.out.println(i);
}


"alpha beta gamma delta".split(" ").forEach(function (x) {
    console.log(x);
});


for (str of "alpha beta gamma delta".split(' ')) { puts(str); }


$$ MODE TUSCRIPT
LOOP/999999999
print "spam"
ENDLOOP


include ..\Utilitys.tlhy

( -2 "field" 3.14159 ( "this" "that" ) ) len [get ?] for

" " input


// version 1.0.6

fun main(args: Array<String>) {
    val greek = arrayOf("alpha", "beta", "gamma", "delta")
    for (letter in greek) print("$letter ")
    println()
    // or alternatively
    greek.forEach { print("$it ") }
    println()
}


while true
	out "SPAM" endl console
end while


                               0000  0000     1 .entry	main,0
                   4D415053 8F   DD  0002     2 	pushl	#^a"SPAM"		;string on stack
                            5E   DD  0008     3 	pushl	sp			;reference to string
                            04   DD  000A     4 	pushl	#4			;+length = descriptor
                                     000C     5 loop:
                            5E   DD  000C     6 	pushl	sp			;descriptor by reference
              00000000'GF   01   FB  000E     7 	calls	#1, g^lib$put_output	;show message
                            F5   11  0015     8 	brb	loop			;forever
                                     0017     9
                                     0017    10 .end	main


{def collection alpha beta gamma delta}
-> collection

{S.map {lambda {:i} {br}:i} {collection}}
->
alpha
beta
gamma
delta

or

{def S.foreach
 {lambda {:s}
  {if {S.empty? {S.rest :s}}
   then {S.first :s}
   else {S.first :s} {br}{S.foreach {S.rest :s}}}}}

{S.foreach {collection}}
->
alpha
beta
gamma
delta


for .i in [1, 2, 3] {
    writeln .i
}

val .abc = "abc"

for .i in .abc {
    writeln .i
}

for .i of .abc {
    writeln .abc[.i]
}

for .i in .abc {
    writeln cp2s .i
}


array(1,2,3) => foreach { stdoutnl(#1) }


(lists:foreach
  (lambda (x)
    (io:format "item: ~p~n" (list x)))
  (lists:seq 1 10))


# Loops/Foreach, in LIL
set collection [list 1 2 "three"]
append collection [list 4 5 six]  # appended as a single item in collection
print "Collection is: $collection"

# using default "i" variable name set for each item
foreach $collection {print $i}

# user named variable in the steps, retrieving accumulated result of loop
# each loop step quotes two copies of the item
set newlist [foreach j $collection {quote $j $j}]
print "Result of second foreach: $newlist"


fn main() {
	for {
		print("SPAM\n")
	}
}


let loop=1
while loop=1
print 1 "SPAM"
wend
end


section .text
	global _start

	_start:
		mov edx, len
		mov ecx, msg
		mov ebx, 1
		mov eax, 4
		int 0x80
		jmp _start

section .data
msg		db "SPAM",0xa
len		equ $-msg


days = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"]
repeat with day in days
  put day
end repeat


"Lisaac loop foreach".split.foreach { word : STRING;
  word.print;
  '\n'.print;
};


repeat for each item x in "red, green, blue"
    put x & cr
    --wait 100 millisec  -- req'd if you want to see in the LC Message Box (akin to repl)
end repeat


(defun keep-printing-spam ()
    (while t
        (display "SPAM")
        (newline) ) )


org		$4000

txt_output:	equ	$bb5a

start:		ld	hl,spam

print:		ld	a,(hl)
		cp	0
		jr	z,start
		call	txt_output
		inc	hl
		jr	print

spam:		defm	"SPAM\r\n\0"


const std = @import("std");
pub fn main() !void {
    const stdout_wr = std.io.getStdOut().writer();
    while (true) try stdout_wr.writeAll("SPAM\n");
}


while(1)   { println("SPAM") }
while(True){ println("SPAM") }
foreach _ in ([0..]){ println("SPAM") }
[0..].pump(Console.println,T(Void,"SPAM"));
[0..].pump(fcn{ println("SPAM") });
fcn{ println("SPAM"); return(self.fcn()) }(); // tail recursive lambda


var loop
loop = 1
while ne loop 0
	print "SPAM"
	println
endwhile


t={monday=1, tuesday=2, wednesday=3, thursday=4, friday=5, saturday=6, sunday=0, [7]="fooday"}
for key, value in pairs(t) do
  print(value, key)
end


Module Checkit {
      \\ Inventories may have keys or keys/values
      \\ here keys are values too
      Inventory Alfa="Apple", "Banana", "Coconut"
      \\ key 30 has value 25, other keys have value same as key.
      Inventory Beta=100, 30:=25, 20, 5
      Print "Parallel"
      k=Each(Alfa)
      k1=Each(Alfa End to Start)
      k2=Each(Beta)
      \\ Parallel iterators
      \\ when one of them end then while end too.
      \\ so 5 not printed. Print 100, 25, 20
      While k,k2, k1 {
            Print Eval$(k), Eval$(k1), Eval(k2)
      }
      Print "Nested"
      \\ Nested iterators
      k=Each(Alfa)
      While k {
      k1=Each(Alfa End to Start)
            While k1 {
                  Print Eval$(k), Eval$(k1)
            }
      }
}
Checkit


for p in [2, 3, 5, 7] do
    print(p);
end do;


s = ([email protected]["ExampleData/USConstitution.txt"])[[1;;7]];
Do[
 [email protected],
 {i, s}
]


    list1 = [1,5,6,7,-7,-9];
    for k = list1,    % list1 must be a row vector (i.e. array of size 1xn)
        printf('%i\n',k)
    end;


arr = for i in 1 to 50 collect ("Number: " + (random 10 99) as string)
makeuniquearray arr
sort arr

for i in arr do print i as string


for x = "mary", "had", "a", "little", "lamb": message x; endfor
end


things = {"Apple", "Banana", "Coconut"};

for thing in (things)
    player:tell(thing);
endfor


for item in collection
    println item
end


def things = ["Apple", "Banana", "Coconut"];

foreach (thing in things) WriteLine(thing.ToLower());
foreach (i in [5, 10 .. 100]) Write($"$i\t");


/* NetRexx */
options replace format comments java crossref savelog symbols nobinary

  say
  say 'Loops/Foreach'

  days = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
  daysl = Arrays.asList(days)
  daysi = daysl.iterator

  loop while daysi.hasNext
    say daysi.next
    end


let list = ["lorem", "ipsum", "dolor"}
for item in list:
  echo item


fruits := ["Apple", "Banana", "Coconut"];
each(i : fruits) {
  fruits[i]->PrintLine();
};


NSArray *collect;
//...
for(Type i in collect){
   NSLog(@"%@", i);
}


List.iter
  (fun i -> Printf.printf "%d\n" i)
  collect_list


a = [ 1,4,3,2 ];
b = [ 1,2,3,4; 5,6,7,8 ];
for v = a
  disp(v); % output single values: 1,4,3,2
endfor
for v = b
  disp(v); % v is the column vector [1;5], then [2;6] ...
endfor


: printMonths | m | Date.Months forEach: m [ m . ] ;


(for-each print '(1 3 4 2))
(print)
(for-each (lambda (a b c) (print a "-" b "/" c))
   '(1 2 3 4)
   '(5 6 7 8)
   '(a b x z))


/* Rexx */
say
say 'Loops/Foreach'
out = ''

days = .array~of('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday')

loop daysi over days
  out ||= daysi' '
  end daysi
say out~strip()

exit


declare
  MyList = [1 2 3 4]
in
  {ForAll MyList Show}

  %% or:
  for E in MyList do {Show E} end


foreach my $i (@collection) {
   print "$i\n";
}


sequence s = {-2,"field",3.14159268979,{"this","that"}}
for i=1 to length(s) do
    ?s[i]
end for


var numbers = 1..10;

numbers each # (number) [
    printf("%i\n", number);
];


foreach ($collect as $i) {
   echo "$i\n";
}

foreach ($collect as $key => $i) {
   echo "\$collect[$key] = $i\n";
}


int main(){
   array(int|string) collect = ({109, "Hi", "asdf", "qwerty"});
   foreach(collect, int|string elem){
      write(elem + "\n");
   }
}


declare A(10) fixed binary;
do i = lbound(A,1) to hbound(A,1);
   put skip list (A(i));
end;


To run:
Start up.
Create a list.
Write each entry in the list to the console.
Destroy the list.
Wait for the escape key.
Shut down.

An entry is a thing with a number.

A list is some entries.

To add a number to a list:
Allocate memory for an entry.
Put the number into the entry's number.
Append the entry to the list.

To create a list:
Add 1 to the list.
Add 2 to the list.
Add 3 to the list.
Add 6 to the list.
Add 7 to the list.
Add 9 to the list.

To write an entry to the console:
Convert the entry's number to a string.
Write the string to the console.

To write each entry in a list to the console:
Get an entry from the list.
Loop.
If the entry is nil, exit.
Write the entry to the console.
Put the entry's next into the entry.
Repeat.


lvars el, lst = [1 2 3 4 foo bar];
for el in lst do
   printf(el,'%p\n');
endfor;


[1 5 3 2] { = } forall
(abc) { = } forall


$colors = "Black","Blue","Cyan","Gray","Green","Magenta","Red","White","Yellow",
          "DarkBlue","DarkCyan","DarkGray","DarkGreen","DarkMagenta","DarkRed","DarkYellow"

foreach ($color in $colors)
{
    Write-Host "$color" -ForegroundColor $color
}


?- foreach(member(X, [red,green,blue,black,white]), writeln(X)).
red
green
blue
black
white
true.


$ "Sweet Boom Pungent Prickle Orange" nest$
witheach [ i times sp echo$ cr ]


a <- list("First", "Second", "Third", 5, 6)
for(i in a) print(i)


#lang racket

;; an example sequence
(define sequence '("something" 1 2 "foo"))

;; works for any sequence
(for ([i sequence])
  (displayln i))


rebol [
	Title: "Loop/Foreach"
	URL: http://rosettacode.org/wiki/Loop/Foreach
]

x: [Sork Gun Blues Neds Thirst Fright Catur]

foreach i x [prin rejoin [i "day "]]  print ""

; REBOL also has the 'forall' construct, which provides the rest of
; the list from the current position.

forall x [prin rejoin [x/1 "day "]]  print ""


>> blk: ["John" 23 "dave" 30 "bob" 20 "Jeff" 40]
>> foreach item blk [print item]
John
23
dave
30
bob
20
Jeff
40
>>  foreach [name age] blk [print [name "is" age "years old"]]
John is 23 years old
dave is 30 years old
bob is 20 years old
Jeff is 40 years old

>> forall blk [print blk]
John 23 dave 30 bob 20 Jeff 40
23 dave 30 bob 20 Jeff 40
dave 30 bob 20 Jeff 40
30 bob 20 Jeff 40
bob 20 Jeff 40
20 Jeff 40
Jeff 40
40


let fruits = ["apple", "banana", "coconut"]

Js.Array2.forEach(fruits, f => Js.log(f))


# Strings

This will display the ASCII code for each character in a string

~~~
'This_is_a_message [ n:put sp ] s:for-each
~~~

# Array

Display each element

~~~
{ #1 #2 #3 }  [ n:put sp ] a:for-each
~~~

# Linked List

Using the dictionary as an example, display each name

~~~
&Dictionary [ d:name s:put sp ] d:for-each
~~~


days = 'zuntik montik dinstik mitvokh donershtik fraytik shabes'

  do j=1  for words(days)              /*loop through days of the week. */
  say word(days,j)                     /*display the weekday to screen. */
  end   /*j*/
                                       /*stick a fork in it, we're done.*/


aList = "Welcome to the Ring Programming Language"
for n in aList
    see n + nl
next


let collection = vec![1,2,3,4,5];
for elem in collection {
    println!("{}", elem);
}


iterate (x; ["Red", "Green", "Blue"])
    x!;


/* Initialize an array with integers 1 to 10, and print their sum */
data _null_;
array a a1-a10;
n=1;
do over a;
  a=n;
  n=n+1;
end;
s=sum(of a{*});
put s;
run;


class MAIN is
  main is
     num:ARRAY{INT} := |1, 5, 4, 3, 10|;
     loop
       -- the iterator elt! behaves like a "foreach",
       -- yielding the next element of the array at each iteration
       #OUT + num.elt! + "\n";
     end;
  end;
end;


val collection = Array(1, 2, 3, 4)
collection.foreach(println)


(for-each
  (lambda (i) (display i) (newline))
  the_list)


for e=["a","b","c"]
    printf("%s\n",e)
end


$ include "seed7_05.s7i";

var array string: things is [] ("Apple", "Banana", "Coconut");

const proc: main is func
  local
    var string: thing is "";
  begin
    for thing range things do
      writeln(thing);
    end for;
  end func;


aCollection do: [| :element | element printLine ].


aCollection do: [ :element | element displayNl ].


let hash = { "foo": 42, "bar": 1337, "baz": "qux" };
foreach(hash, function(key, val) {
    print(key, " -> ", val);
});


app
  (fn i => print (Int.toString i ^ "\n"))
  collect_list


local a 2 9 4 7 5 3 6 1 8
foreach i in `a' {
	display "`i'"
}


program main;
  int values[$];

  initial begin
    values = '{ 1, 3, 7, 11 };
    foreach (values[i]) begin
       $display( "%0d --> %0d", i, values[i] );
    end
  end
endprogram


foreach i {foo bar baz} {
    puts "$i"
}


$$ MODE TUSCRIPT
week="Monday'Tuesday'Wednesday'Thursday'Friday'Saterday'Sunday"
LOOP day=week
PRINT day
ENDLOOP


for file in *.sh; do
  echo "filename is $file"
done


List<string> things = new List<string> ();
things.append("Apple");
things.append("Banana");
things.append("Coconut");

foreach (string thing in things)
{
  stdout.printf("%s\n", thing);
}


for i in ["alpha", "beta", 42, 5.54]
    echo i
endfor


fn print_all(values []int) {
   for i, x in values {
      println("Item $i = $x")
   }
}


let a => import 'arrays';
let s => import 'stream';

a.stream [5; 7; 3]
-> s.map (io.writeln io.stdout)
-> s.drain
;


for (f in ["apples", "oranges", "pears"]) System.print(f)


(FOR-EACH PRINT '(CYRUS CAMBYSES DARIUS XERXES ARTAXERXES))


include c:\cxpl\codes;
int List, I;
[List:= ["Red", "Green", "Blue", "Black", "White"];
for I:= 0, 5-1 do
        [Text(0, List(I));  CrLf(0)];
]


<fo:block font-weight="bold">Adults:</fo:block>
<xsl:for-each select="person[@age >= 21]">
  <fo:block><xsl:value-of select="position()"/>. <xsl:value-of select="@name"/></fo:block>
</xsl:for-each>


const warn = @import("std").debug.warn;

pub fn main() void {
    const items = [_]i16{ 0, 1, 1, 2, 3, 5, 8 };

    for (items) |i| {
        warn("{}\n", .{i});
    }
}


foreach c in (T("Red","Green","Blue","Black","White"))
  { print(c," "); }


const std = @import("std");

pub fn main() !void {
    const stdout_wr = std.io.getStdOut().writer();

    // 1. Index element index sizes are comptime-known
    const a1: []const u8 = &[_]u8{ 'a', 'b', 'c' };
    // also works with slices
    //const a2: [] u8 = &a1;
    for (a1) |el_a|
        try stdout_wr.print("{c}\n", .{el_a});
    // 2. Index element index sizes are not comptime-known
    // Convention is to provide a `next()` method.
    // TODO
}


V val = 0
L
   val++
   print(val)
   I val % 6 == 0
      L.break


*        Do-While
DOWHILE CSECT  ,                  This program's control section
         BAKR  14,0               Caller's registers to linkage stack
         LR    12,15              load entry point address into Reg 12
        USING  DOWHILE,12         tell assembler we use Reg 12 as base
         XR    9,9                clear Reg 9 - divident value
         LA    6,6                load divisor value 6 in Reg 6
         LA    8,WTOLEN           address of WTO area in Reg 8
LOOP     DS    0H
         LA    9,1(,9)            add 1 to divident Reg 9
         ST    9,FW2              store it
         LM    4,5,FDOUBLE        load into even/odd register pair
         STH   9,WTOTXT           store divident in text area
         MVI   WTOTXT,X'F0'       first of two bytes zero
         OI    WTOTXT+1,X'F0'     make second byte printable
        WTO    TEXT=(8)           print it (Write To Operator macro)
         DR    4,6                divide Reg pair 4,5 by Reg 6
         LTR   5,5                test quotient (remainder in Reg 4)
         BNZ   RETURN             if one: 6 iterations, exit loop.
         B     LOOP               if zero: loop again.
RETURN   PR    ,                  return to caller.
FDOUBLE  DC    0FD
         DC    F'0'
FW2      DC    F'0'
WTOLEN   DC    H'2'               fixed WTO length of two
WTOTXT   DC    CL2' '
         END   DOWHILE


DoWhileSub:	PHA
		TYA
		PHA			;push accumulator and Y register onto stack

		LDY #0
DoWhileLoop:	INY
		JSR DisplayValue	;routine not implemented
		TYA
		SEC
Modulus:	SBC #6
		BCS Modulus
		ADC #6
		BNE DoWhileLoop

		PLA
		TAY
		PLA			;restore Y register and accumulator from stack
		RTS			;return from subroutine


/* ARM assembly AARCH64 Raspberry PI 3B */
/*  program loopdowhile64.s   */

/*******************************************/
/* Constantes file                         */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"

/*********************************/
/* Initialized data              */
/*********************************/
.data
szMessResult:  .asciz "Counter =  @ \n"      // message result

/*********************************/
/* UnInitialized data            */
/*********************************/
.bss
sZoneConv:          .skip 24
/*********************************/
/*  code section                 */
/*********************************/
.text
.global main
main:                          // entry of program
    mov x20,0                  // indice
    mov x21,6
1:                             // begin loop
    mov x0,x20
    ldr x1,qAdrsZoneConv       // conversion value value
    bl conversion10            // decimal
    ldr x0,qAdrszMessResult
    ldr x1,qAdrsZoneConv       // display conversion
    bl strInsertAtCharInc      // insert result at @ character
    bl affichageMess           // display message
    add x20,x20,1              // increment counter
    udiv x0,x20,x21            // divide by 6
    msub x1,x0,x21,x20         // compute remainder
    cbnz x1,1b                 // loop if remainder <> zéro

100:                           // standard end of the program
    mov x0,0                   // return code
    mov x8,EXIT                // request to exit program
    svc 0                      // perform the system call

qAdrsZoneConv:          .quad sZoneConv
qAdrszMessResult:       .quad szMessResult
/********************************************************/
/*        File Include fonctions                        */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"


Proc Main()
 byte A

 A=0
 Do
  A==+1
  PrintBE(A)
  Until A Mod 6=0
 Od
Return


var val:int = 0;
do
{
    trace(++val);
} while (val % 6);


loop
   Value := Value + 1;
   Put (Value);
   exit when Value mod 6 = 0;
end loop;


scope
    local i := 0;
    do
        inc i, 1;
        print( i )
    as ( i % 6 ) <> 0
epocs


integer a;

a = 0;
do {
   a += 1;
   o_integer(a);
   o_byte('\n');
} while (a % 6 != 0);


'BEGIN' 'COMMENT' Loops DoWhile  - Algol60 - 22/06/2018;
  'INTEGER' I;
  I:=0;
LOOP:
    I:=I+1;
    OUTINTEGER(1,I);
    'IF' I=I'/'6*6 'THEN' 'GOTO' ENDLOOP;
  'GOTO' LOOP;
ENDLOOP:
'END'


FOR value WHILE
  print(value);
# WHILE # value MOD 6 /= 0 DO
  SKIP
OD


begin
    integer i;
    i := 0;
    while
        begin
            i := i + 1;
            write( i );
            ( i rem 6 ) not = 0
        end
    do begin end
end.


PROC main()
  DEF i = 0
  REPEAT
    i := i + 1
    WriteF('\d\n', i)
  UNTIL Mod(i, 6) = 0
ENDPROC


/* ARM assembly Raspberry PI  */
/*  program loopdowhile.s   */

/* Constantes    */
.equ STDOUT, 1     @ Linux output console
.equ EXIT,   1     @ Linux syscall
.equ WRITE,  4     @ Linux syscall

/*********************************/
/* Initialized data              */
/*********************************/
.data
szMessResult:  .ascii "Counter = "      @ message result
sMessValeur:   .fill 12, 1, ' '
                   .asciz "\n"
/*********************************/
/* UnInitialized data            */
/*********************************/
.bss
/*********************************/
/*  code section                 */
/*********************************/
.text
.global main
main:                @ entry of program
    push {fp,lr}      @ saves 2 registers
    mov r4,#0
1:    @ begin loop
    mov r0,r4

    ldr r1,iAdrsMessValeur     @ display value
    bl conversion10             @ call function with 2 parameter (r0,r1)
    ldr r0,iAdrszMessResult
    bl affichageMess            @ display message
    add r4,#1                   @ increment counter
    mov r0,r4
    mov r1,#6              @ division conuter by 6
    bl division
    cmp r3,#0              @ remainder = zéro ?
    bne 1b                @ no ->begin loop one

100:   @ standard end of the program
    mov r0, #0                  @ return code
    pop {fp,lr}                 @restaur 2 registers
    mov r7, #EXIT              @ request to exit program
    svc #0                       @ perform the system call

iAdrsMessValeur:          .int sMessValeur
iAdrszMessResult:         .int szMessResult
/******************************************************************/
/*     display text with size calculation                         */
/******************************************************************/
/* r0 contains the address of the message */
affichageMess:
    push {r0,r1,r2,r7,lr}      @ save  registres
    mov r2,#0                  @ counter length
1:      @ loop length calculation
    ldrb r1,[r0,r2]           @ read octet start position + index
    cmp r1,#0                  @ if 0 its over
    addne r2,r2,#1            @ else add 1 in the length
    bne 1b                    @ and loop
                                @ so here r2 contains the length of the message
    mov r1,r0        			@ address message in r1
    mov r0,#STDOUT      		@ code to write to the standard output Linux
    mov r7, #WRITE             @ code call system "write"
    svc #0                      @ call systeme
    pop {r0,r1,r2,r7,lr}        @ restaur des  2 registres */
    bx lr                       @ return
/******************************************************************/
/*     Converting a register to a decimal                                 */
/******************************************************************/
/* r0 contains value and r1 address area   */
conversion10:
    push {r1-r4,lr}    @ save registers
    mov r3,r1
    mov r2,#10

1:	   @ start loop
    bl divisionpar10 @ r0 <- dividende. quotient ->r0 reste -> r1
    add r1,#48        @ digit
    strb r1,[r3,r2]  @ store digit on area
    sub r2,#1         @ previous position
    cmp r0,#0         @ stop if quotient = 0 */
    bne 1b	          @ else loop
    @ and move spaces in first on area
    mov r1,#' '   @ space
2:
    strb r1,[r3,r2]  @ store space in area
    subs r2,#1       @ @ previous position
    bge 2b           @ loop if r2 >= zéro

100:
    pop {r1-r4,lr}    @ restaur registres
    bx lr	          @return
/***************************************************/
/*   division par 10   signé                       */
/* Thanks to http://thinkingeek.com/arm-assembler-raspberry-pi/*
/* and   http://www.hackersdelight.org/            */
/***************************************************/
/* r0 dividende   */
/* r0 quotient */
/* r1 remainder  */
divisionpar10:
  /* r0 contains the argument to be divided by 10 */
    push {r2-r4}   /* save registers  */
    mov r4,r0
    mov r3,#0x6667   @ r3 <- magic_number  lower
    movt r3,#0x6666  @ r3 <- magic_number  upper
    smull r1, r2, r3, r0   @ r1 <- Lower32Bits(r1*r0). r2 <- Upper32Bits(r1*r0)
    mov r2, r2, ASR #2     /* r2 <- r2 >> 2 */
    mov r1, r0, LSR #31    /* r1 <- r0 >> 31 */
    add r0, r2, r1         /* r0 <- r2 + r1 */
    add r2,r0,r0, lsl #2   /* r2 <- r0 * 5 */
    sub r1,r4,r2, lsl #1   /* r1 <- r4 - (r2 * 2)  = r4 - (r0 * 10) */
    pop {r2-r4}
    bx lr                  /* leave function */
/***************************************************/
/* integer division unsigned                       */
/***************************************************/
division:
    /* r0 contains dividend */
    /* r1 contains divisor */
    /* r2 returns quotient */
    /* r3 returns remainder */
    push {r4, lr}
    mov r2, #0                @ init quotient
    mov r3, #0                @ init remainder
    mov r4, #32               @ init counter bits
    b 2f
1:          @ loop
    movs r0, r0, LSL #1     @ r0 <- r0 << 1 updating cpsr (sets C if 31st bit of r0 was 1)
    adc r3, r3, r3           @ r3 <- r3 + r3 + C. This is equivalent to r3 ? (r3 << 1) + C
    cmp r3, r1               @ compute r3 - r1 and update cpsr
    subhs r3, r3, r1        @ if r3 >= r1 (C=1) then r3 ? r3 - r1
    adc r2, r2, r2           @ r2 <- r2 + r2 + C. This is equivalent to r2 <- (r2 << 1) + C
2:
    subs r4, r4, #1          @ r4 <- r4 - 1
    bpl 1b                  @ if r4 >= 0 (N=0) then loop
    pop {r4, lr}
    bx lr


on printConsole(x)
	return x as string
end printConsole

set {i, table} to {0, {return}}
repeat while (i mod 6 is not 0 or i is not 6)
	set i to i + 1
	set end of table to i & return
	printConsole(table)
end repeat


value: 0
until [
	value: value + 1
	print value
] [ 0 = value%6 ]


int i = 0;
do {
    ++i;
  write(" ", i, suffix=none);
} while (i % 6 != 0);


While mod(A_Index, 6) ;comment:everything but 0 is considered true
  output = %output%`n%A_Index%
MsgBox % output


BEGIN {
  val = 0
  do {
    val++
    print val
  } while( val % 6 != 0)
}


0→A
While 1
 A++
 Disp A▶Dec,i
End!If A^6


a = 0
DO
  a = a + 1
  PRINT a
LOOP WHILE a MOD 6 <> 0


L(i) 1..5
   L 1..i
      print(‘*’, end' ‘’)
   print()


i = 0
for (;;) {
	++i	/* increments then prints i */
	if (i % 6 == 0) break
}
quit


int val = 0;
do{
   val++;
   printf("%d\n",val);
}while(val % 6 != 0);


*        Loops/For - BXH Algol     27/07/2015
LOOPFOR  CSECT
         USING  LOOPFORC,R12
         LR     R12,R15            set base register
BEGIN    LA     R2,0               from 1 (from-step=0)
         LA     R4,1               step 1
         LA     R5,5               to 5
LOOPI    BXH    R2,R4,ELOOPI       for i=1 to 5  (R2=i)
         LA     R8,BUFFER-1          ipx=-1
         LA     R3,0                 from 1 (from-step=0)
         LA     R6,1                 step 1
         LR     R7,R2                to i
LOOPJ    BXH    R3,R6,ELOOPJ         for j:=1 to i  (R3=j)
         LA     R8,1(R8)               ipx=ipx+1
         MVI    0(R8),C'*'             buffer(ipx)='*'
         B      LOOPJ                next j
ELOOPJ   XPRNT  BUFFER,L'BUFFER      print buffer
         B      LOOPI              next i
ELOOPI   BR     R14                return to caller
BUFFER   DC     CL80' '            buffer
         YREGS
         END    LOOPFOR


main:
     MOVEQ #1,D1           ;counter for how many times to print *, this is also the loop counter
.outerloop:
     MOVE.W D1,D2
     SUBQ.W #1,D2
.innerloop:
     MOVE.B #'*',D0
     JSR PrintChar         ;hardware-dependent printing routine
DBRA D2,.innerloop         ;DBRA loops until wraparound to $FFFF, which is why we subtracted 1 from D2 earlier.
     JSR NewLine           ;hardware-dependent newline routine
     ADDQ.W #1,D1
     CMP.W #6,D1           ;are we done yet?
     BCS .outerloop        ;if not, go back to the top
     RTS


int a = 0;

do
{
    a += 1;
    Console.WriteLine(a);
} while (a % 6 != 0);


StarSub:

mov ah,02h  ;needed to prime the interrupt command for printing to screen
mov ch,1    ;outer loop counter

outer_loop:
mov cl,ch   ;refresh the inner loop counter, by copying the value of the outer loop counter to it.
            ;each time the inner loop finishes, it will last one iteration longer the next time.

inner_loop:
mov dl,02Ah ;ascii for *
int 21h     ;tells DOS to print the contents of dl to the screen
dec cl
jnz inner_loop
mov dl,13   ;Carriage Return
int 21h
mov dl,10   ;New Line
int 21h

inc ch      ;make the outer loop counter bigger for next time.
cmp ch,5
jnz outer_loop

ret


int val = 0;
do{
   val++;
   std::cout << val << std::endl;
}while(val % 6 != 0);


var val = 0;
do {
        val += 1;
        writeln(val);
} while val % 6 > 0;


0 => int value;
do
{
    value++;
    <<<value>>>;
}
while(value % 6 != 0);


/* ARM assembly AARCH64 Raspberry PI 3B */
/*  program loop64.s   */

/*******************************************/
/* Constantes file                         */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"
/*******************************************/
/* Initialized data                        */
/*******************************************/
.data
szMessX: .asciz "X"
szCarriageReturn:  .asciz "\n"
/*******************************************/
/* UnInitialized data                      */
/*******************************************/
.bss
/*******************************************/
/*  code section                           */
/*******************************************/
.text
.global main
main:                     // entry of program

    mov x2,0              // counter loop 1
1:                        // loop start 1
    mov x1,0              // counter loop 2
2:                        // loop start 2
    ldr x0,qAdrszMessX
    bl affichageMess
    add x1,x1,1           // x1 + 1
    cmp x1,x2             // compare x1 x2
    ble 2b                // loop label 2 before
    ldr x0,qAdrszCarriageReturn
    bl affichageMess
    add x2,x2,1           // x2 + 1
    cmp x2,#5             // for five loop
    blt 1b                // loop label 1 before

100:                      // standard end of the program */
    mov x0,0              // return code
    mov x8,EXIT           // request to exit program
    svc 0                 // perform the system call

qAdrszMessX:           .quad szMessX
qAdrszCarriageReturn:  .quad  szCarriageReturn
/********************************************************/
/*        File Include fonctions                        */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"


Proc Main()
byte I,J

 For I=1 to 5
  Do
   For J=1 to I
    Do
     Print("*")
    Od
   PrintE("")
  Od

Return


   Local n := 0
   DO WHILE .T.
      ? ++n
      IF n % 6 == 0
         EXIT
      ENDIF
   ENDDO


(loop [i 0]
  (let [i* (inc i)]
    (println i*)
    (when-not (zero? (mod i* 6))
      (recur i*))))


       IDENTIFICATION DIVISION.
       PROGRAM-ID. loop-do-while.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  i PIC 99 VALUE 0.

       PROCEDURE DIVISION.
           PERFORM WITH TEST AFTER UNTIL FUNCTION MOD(i, 6) = 0
               ADD 1 TO i
               DISPLAY i
           END-PERFORM

           GOBACK
           .


var str:String = "";
for (var i:int = 1; i <= 5; i++) {
	for (var j:int = 1; j <= i; j++)
		str += "*";
	trace(str);
	str = "";
}


for I in 1..5 loop
   for J in 1..I loop
      Put("*");
   end loop;
   New_Line;
end loop;


for i to 5 do
    for j to i do
        write( "*" )
    od;
    print()
od


val = 0
loop
  console.log ++val
  break unless val % 6


<cfscript>
  value = 0;
  do
  {
    value += 1;
    writeOutput( value );
  } while( value % 6 != 0 );
</cfscript>


(let ((val 0))
  (loop do
        (incf val)
        (print val)
        while (/= 0 (mod val 6))))


INTEGER I,J;
FOR I:=1 STEP 1 UNTIL 5 DO
BEGIN
   FOR J:=1 STEP 1 UNTIL I DO
      OUTTEXT("*");
   OUTLINE
END


FOR i TO 5 DO
   TO i DO
      print("*")
   OD;
  print(new line)
OD


begin
    for i := 1 until 5 do
    begin
        write( "*" );
        for j := 2 until i do
        begin
            writeon( "*" )
        end j
    end i
end.


import std.stdio;

void main() {
    int val;
    do {
        val++;
        write(val, " ");
    } while (val % 6 != 0);
}


0 si		[i = 0]sz
[2Q]sA		[A = code to break loop]sz
[
 li 1 + p	[print it = i + 1]sz
 d si		[i = it, leave it on stack]sz
 6 % 0 =A	[call A if 0 == it % 6]sz
 0 0 =B		[continue loop]sz
]sB 0 0 =B


program Loop;

{$APPTYPE CONSOLE}

var
  I: Integer;

begin
  I:= 0;
  repeat
    Inc(I);
    Write(I:2);
  until I mod 6 = 0;
  Writeln;
  Readln;
end.


BEGIN
    INTEGER I, J;
    FOR I := 1 STEP 1 UNTIL 5 DO
    BEGIN
        WRITE( "" );
        FOR J := 1 STEP 1 UNTIL I DO
            WRITEON( "*" );
    END;
END


for i in 0 to 6
  for j in 0 to i
      Write('*')
  end
  WriteLn()
end


PROC main()
  DEF i, j
  FOR i := 1 TO 5
    FOR j := 1 TO i DO WriteF('*')
    WriteF('\n')
  ENDFOR
ENDPROC


proc nonrec main() void:
    byte i;
    i := 0;
    while
        i := i + 1;
        write(i:2);
        i % 6 ~= 0
    do od
corp


val = 0
do{
   val++
   showln val
}while(val % 6 != 0)


[1+$.' ,]⇒A   {operator definition: PUSH 1, ADD, DUP, print top of stack to SDTOUT, print whitespace}
[1+$.' ,]a:    {function definition}


var i := 0;

repeat
   Inc(i);
   PrintLn(i);
until i mod 6 = 0;


for (Integer i = 0; i < 5; i++) {
    String line = '';

    for (Integer j = 0; j < i; j++) {
        line += '*';
    }

    System.debug(line);
}

List<String> lines = new List<String> {
    '*',
    '**',
    '***',
    '****',
    '*****'
};

for (String line : lines) {
    System.debug(line);
}


set x to linefeed
repeat with i from 1 to 5
	repeat with j from 1 to i
		set x to x & "*"
	end repeat
	set x to x & linefeed
end repeat
return x


var x = 0

do
{
    x += 1
    print(x)
} while x % 6 != 0


var x := 0
__loop(fn {
    x += 1
    println(x)
    x % 6 != 0   # this is the return value of the function
})


open monad io

loop n | n % 6 == 0 = do return ()
       | else = do
          putStrLn (show n)
          loop (n+1)

_ = loop 10 ::: IO


defmodule Loops do
  def do_while(n) do
    n1 = n + 1
    IO.puts n1
    if rem(n1, 6) == 0, do: :ok,
                      else: do_while(n1)
  end
end

Loops.do_while(0)


/* ARM assembly Raspberry PI  */
/*  program loop1.s   */

/* Constantes    */
.equ STDOUT, 1     @ Linux output console
.equ EXIT,   1     @ Linux syscall
.equ WRITE,  4     @ Linux syscall
/* Initialized data */
.data
szMessX: .asciz "X"
szCarriageReturn:  .asciz "\n"

/* UnInitialized data */
.bss

/*  code section */
.text
.global main
main:                /* entry of program  */
    push {fp,lr}    /* saves 2 registers */

    mov r2,#0       @ counter loop 1
1:       @ loop start 1
    mov r1,#0        @ counter loop 2
2:       @ loop start 2
    ldr r0,iAdrszMessX
    bl affichageMess
    add r1,#1       @ r1 + 1
    cmp r1,r2       @ compare r1 r2
    ble 2b        @ loop label 2 before
    ldr r0,iAdrszCarriageReturn
    bl affichageMess
    add r2,#1       @ r2 + 1
    cmp r2,#5       @ for five loop
    blt 1b         @ loop label 1 before

100:   /* standard end of the program */
    mov r0, #0                  @ return code
    pop {fp,lr}                 @restaur 2 registers
    mov r7, #EXIT              @ request to exit program
    swi 0                       @ perform the system call

iAdrszMessX:  .int szMessX
iAdrszCarriageReturn:  .int  szCarriageReturn
/******************************************************************/
/*     display text with size calculation                         */
/******************************************************************/
/* r0 contains the address of the message */
affichageMess:
    push {fp,lr}    			/* save  registres */
    push {r0,r1,r2,r7}    		/* save others registers */
    mov r2,#0   				/* counter length */
1:      	/* loop length calculation */
    ldrb r1,[r0,r2]  			/* read octet start position + index */
    cmp r1,#0       			/* if 0 its over */
    addne r2,r2,#1   			/* else add 1 in the length */
    bne 1b          			/* and loop */
                                /* so here r2 contains the length of the message */
    mov r1,r0        			/* address message in r1 */
    mov r0,#STDOUT      		/* code to write to the standard output Linux */
    mov r7, #WRITE             /* code call system "write" */
    swi #0                      /* call systeme */
    pop {r0,r1,r2,r7}     		/* restaur others registers */
    pop {fp,lr}    				/* restaur des  2 registres */
    bx lr	        			/* return  */


(let ((val 0))
  (while (progn
           (setq val (1+ val))
           (message "%d" val)
           (/= 0 (mod val 6)))))


A=0
REPEAT
  A=A+1
  PRINT(A)
UNTIL A MOD 6=0  !UNTIL A-6*INT(A/6)=0 for C-64


loop 0..5 'x [
	loop 0..x 'y [
		prints "*"
	]
	print ""
]


for(int i = 0; i < 6; ++i) {
  for(int j = 0; j < i; ++j) {
    write("*", suffix=none);
  }
    write("");
}


include std/console.e
include std/math.e

atom x = 0

loop do
	x += 1
	?x
	until(mod(x,6)) = 0
end loop

if getc(0) then end if


let rec loop n =
  printfn "%d " n
  if (n+1)%6 > 0 then loop (n+1)
loop 0


0 [ dup 6 mod 0 = not ] [ [ . ] [ 1 + ] bi ] do while drop


*        Loops/Downward for        27/07/2015
LOOPDOWN CSECT
         USING  LOOPDOWN,R12
         LR     R12,R15            set base register
BEGIN    EQU    *
*        fisrt loop with a BXLE    BXLE: Branch on indeX Low or Equal
         LH     R2,=H'11'          from 10 (R2=11) index
         LH     R4,=H'-1'          step -1 (R4=-1)
         LH     R5,=H'-1'          to 0    (R5=-1)
LOOPI    BXLE   R2,R4,ELOOPI       R2=R2+R4 if R2<=R5 goto ELOOPI
         XDECO  R2,BUFFER          edit R2
         XPRNT  BUFFER,L'BUFFER    print
         B      LOOPI
ELOOPI   EQU    *
*        second loop with a BCT    BCT: Branch on CounT
         LA     R2,10              index   R2=10
         LA     R3,11              counter R3=11
LOOPJ    XDECO  R2,BUFFER          edit R2
         XPRNT  BUFFER,L'BUFFER    print
         BCTR   R2,0               R2=R2-1
ELOOPJ   BCT    R3,LOOPJ           R3=R3-1 if R3<>0 goto LOOPI
RETURN   XR     R15,R15            set return code
         BR     R14                return to caller
BUFFER   DC     CL80' '
         YREGS
         END    LOOPDOWN


;An OS/hardware specific routine that is setup to display the Ascii character
;value contained in the Accumulator
Send 		= 	$9000		;routine not implemented here
PrintNewLine	=	$9050		;routine not implemented here

  		*= 	$8000		;set base address
Start		PHA			;push Accumulator and Y register onto stack
		TYA
		PHA
		LDY 	#10		;set Y register to loop start value
		TYA			;place loop value in the Accumulator
Loop		JSR	PrintTwoDigits
		JSR   PrintNewLine
		DEY			;decrement loop value
		BPL	Loop		;continue loop if sign flag is clear
		PLA			;pop Y register and Accumulator off of stack
		TAY
		PLA
		RTS			;exit

;Print value in Accumulator as two hex digits
PrintTwoDigits
		PHA
		LSR
		LSR
		LSR
		LSR
		JSR     PrintDigit
		PLA
		AND     #$0F
		JSR     PrintDigit
		RTS

;Convert value in Accumulator to an Ascii hex digit
PrintDigit
		ORA	#$30
		JSR	Send		;routine not implemented here
		RTS


ForLoop:
MOVE.W #10,D0
loop:
JSR Print_D0_As_Ascii  ;some routine that converts the digits of D0 into ascii characters and prints them to screen.
DBRA D0,loop           ;repeat until D0.W = $FFFF
rts


       .model small ;.exe file, max 128 KB
       .stack 1024  ;reserve 1 KB for the stack pointer.

       .data

       ;no data needed

       .code
start:

	mov ax,0100h	;UNPACKED BCD "10"
	mov cx,0Bh	;loop counter

repeat_countdown:
	call PrintBCD_IgnoreLeadingZeroes
	sub ax,1
	aas
	;ascii adjust for subtraction, normally 0100h - 1 = 0FFh but this corrects it to 0009h
	push ax
		mov dl,13
		mov ah,02h
		int 21h

		mov dl,10
		mov ah,02h
		int 21h
		;these 6 lines of code are the "new line" function
	pop ax
	loop repeat_countdown ;decrement CX and jump back to the label "repeat_countdown" if CX != 0

	mov ax,4C00h
	int 21h			;return to DOS

PrintBCD_IgnoreLeadingZeroes:
	push ax
		cmp ah,0
		jz skipLeadingZero
			or ah,30h         ;convert a binary-coded decimal quantity to an ASCII numeral
			push dx
			push ax
				mov al,ah
				mov ah,0Eh
				int 10h	   ;prints AL to screen
			pop ax
			pop dx
skipLeadingZero:
		or al,30h
		push dx
		push ax
			mov ah,0Eh
			int 10h
		pop ax
		pop dx
	pop ax
	ret

        end start ;EOF


Gui, Add, Edit, vOutput r5 w100 -VScroll ; Create an Edit-Control
Gui, Show ; Show the window
Loop, 5 ; loop 5 times
{
  Loop, %A_Index% ; A_Index contains the Index of the current loop
  {
    output .= "*" ; append an "*" to the output var
    GuiControl, , Output, %Output% ; update the Edit-Control with the new content
    Sleep, 500 ; wait some(500ms) time, [just to show off]
  }
  Output .= (A_Index = 5) ? "" : "`n" ; append a new line to the output if A_Index is not "5"
}
Return ; End of auto-execution section


For each row from 1 to 5 do
[
    For each length from 1 to row do [Print: "*";];
    Print: "\n";
];


class Main
{
  public static Void main ()
  {
    i := 0
    while (true)
    {
      i += 1
      echo (i)
      if (i % 6 == 0) break // end loop on condition
    }
  }
}


: do-until
  0
  begin 1+
        dup .
        dup 6 mod 0=
  until
  drop ;


INTEGER :: i = 0
DO
  i = i + 1
  WRITE(*, *) i
  IF (MOD(i, 6) == 0) EXIT
END DO


component loops_do_while
  export Executable

  var x:ZZ32 = 0
  run() = label loop
    while true do
      x += 1
      println(x)

      if (x MOD 6) = 0
      then exit loop
      end
    end
  end loop
end


/* ARM assembly AARCH64 Raspberry PI 3B */
/*  program loopdownward64.s   */

/*******************************************/
/* Constantes file                         */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"

/*********************************/
/* Initialized data              */
/*********************************/
.data
szMessResult:  .asciz "Counter =  @ \n"      // message result

/*********************************/
/* UnInitialized data            */
/*********************************/
.bss
sZoneConv:              .skip 24
/*********************************/
/*  code section                 */
/*********************************/
.text
.global main
main:                          // entry of program
    mov x4,#10
1:                             // begin loop
    mov x0,x4
    ldr x1,qAdrsZoneConv       // display value
    bl conversion10            // call decimal conversion
    ldr x0,qAdrszMessResult
    ldr x1,qAdrsZoneConv       // display value
    bl strInsertAtCharInc      // insert result at @ character
    bl affichageMess           // display message
    subs x4,x4,1               // decrement counter
    bge 1b                     // loop if greather

100:                           // standard end of the program
    mov x0,0                   // return code
    mov x8,EXIT                // request to exit program
    svc 0                      // perform the system call

qAdrsZoneConv:            .quad sZoneConv
qAdrszMessResult:         .quad szMessResult
/********************************************************/
/*        File Include fonctions                        */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"


for I in reverse 0..10 loop
   Put_Line(Integer'Image(I));
end loop;


for i from 10 downto 0 do
    print( i )
od


 begin
   integer i;
   for i:=10 step -1 until 0 do
     outinteger(i)
 end


BEGIN {
  for(i=1; i < 6; i++) {
    for(j=1; j <= i; j++ ) {
      printf "*"
    }
    print
  }
}


ClrHome
For(I,1,5)
For(J,1,I)
Output(J,I,"*")
End
End


((main { 10 star_triangle ! })

(star_triangle {
    dup
    <-
    { dup { "*" << } <->
            iter - 1 +
        times
        "\n" << }
    ->
    times }))


' FB 1.05. 0 Win64

Dim i As Integer = 0
Do
  i += 1
  Print i; " ";
Loop While i Mod 6 <> 0
Print
Sleep


n = 0
do
{
   n = n + 1
   println[n]
} while n mod 6 != 0


window 1

dim as long i

do
  i++
  print i
until ( i mod 6 == 0 )

HandleEvents


Public Sub Main()
Dim siCount As Short

Repeat
  Inc siCount
  Print siCount;;
Until siCount Mod 6 = 0

End


FOR i FROM 10 BY -1 TO 0 DO
    print((i,new line))
OD


begin
    for i := 10 step -1 until 0 do
    begin
        write( i )
    end
end.


#include <flow.h>

DEF-MAIN
   CLR-SCR
   SET(i, 10)
   LOOP(ciclo abajo)
      PRNL(i)
   BACK-IF-NOT-ZERO(i--, ciclo abajo)
END


PROC main()
  DEF i
  FOR i := 10 TO 0 STEP -1
    WriteF('\d\n', i)
  ENDFOR
ENDPROC


for i in {1..5}
do
  for ((j=1; j<=i; j++));
  do
    echo -n "*"
  done
  echo
done


FOR i = 1 TO 5
   FOR j = 1 TO i
      PRINT "*";
   NEXT j
   PRINT
NEXT i


n := 0;
repeat
    n := n + 1;
    Print(n, "\n");
until RemInt(n, 6) = 0;


i = 0
do
    {
    i += 1
    show_message(string(i))
    }
until (i mod 6 = 0)


package main

import "fmt"

func main() {
	var value int
	for {
		value++
		fmt.Println(value)
                if value%6 != 0 {
                        break
                }
	}
}


def i = 0
do {
    i++
    println i
} while (i % 6 != 0)


repeat with i from 10 to 0 by -1
  log i
end repeat


/* ARM assembly Raspberry PI  */
/*  program loopdownward.s   */

/* Constantes    */
.equ STDOUT, 1     @ Linux output console
.equ EXIT,   1     @ Linux syscall
.equ WRITE,  4     @ Linux syscall

/*********************************/
/* Initialized data              */
/*********************************/
.data
szMessResult:  .ascii "Counter = "      @ message result
sMessValeur:   .fill 12, 1, ' '
                   .asciz "\n"
/*********************************/
/* UnInitialized data            */
/*********************************/
.bss
/*********************************/
/*  code section                 */
/*********************************/
.text
.global main
main:                @ entry of program
    push {fp,lr}      @ saves 2 registers
    mov r4,#10
1:    @ begin loop
    mov r0,r4
    ldr r1,iAdrsMessValeur     @ display value
    bl conversion10             @ call function with 2 parameter (r0,r1)
    ldr r0,iAdrszMessResult
    bl affichageMess            @ display message
    subs r4,#1                   @ decrement counter
    bge 1b                      @ loop if greather

100:   @ standard end of the program
    mov r0, #0                  @ return code
    pop {fp,lr}                 @restaur 2 registers
    mov r7, #EXIT              @ request to exit program
    svc #0                       @ perform the system call

iAdrsMessValeur:          .int sMessValeur
iAdrszMessResult:         .int szMessResult
/******************************************************************/
/*     display text with size calculation                         */
/******************************************************************/
/* r0 contains the address of the message */
affichageMess:
    push {r0,r1,r2,r7,lr}      @ save  registres
    mov r2,#0                  @ counter length
1:      @ loop length calculation
    ldrb r1,[r0,r2]           @ read octet start position + index
    cmp r1,#0                  @ if 0 its over
    addne r2,r2,#1            @ else add 1 in the length
    bne 1b                    @ and loop
                                @ so here r2 contains the length of the message
    mov r1,r0        			@ address message in r1
    mov r0,#STDOUT      		@ code to write to the standard output Linux
    mov r7, #WRITE             @ code call system "write"
    svc #0                      @ call systeme
    pop {r0,r1,r2,r7,lr}        @ restaur des  2 registres */
    bx lr                       @ return
/******************************************************************/
/*     Converting a register to a decimal                                 */
/******************************************************************/
/* r0 contains value and r1 address area   */
conversion10:
    push {r1-r4,lr}    @ save registers
    mov r3,r1
    mov r2,#10

1:	   @ start loop
    bl divisionpar10 @ r0 <- dividende. quotient ->r0 reste -> r1
    add r1,#48        @ digit
    strb r1,[r3,r2]  @ store digit on area
    sub r2,#1         @ previous position
    cmp r0,#0         @ stop if quotient = 0 */
    bne 1b	          @ else loop
    @ and move spaces in first on area
    mov r1,#' '   @ space
2:
    strb r1,[r3,r2]  @ store space in area
    subs r2,#1       @ @ previous position
    bge 2b           @ loop if r2 >= zéro

100:
    pop {r1-r4,lr}    @ restaur registres
    bx lr	          @return
/***************************************************/
/*   division par 10   signé                       */
/* Thanks to http://thinkingeek.com/arm-assembler-raspberry-pi/*
/* and   http://www.hackersdelight.org/            */
/***************************************************/
/* r0 dividende   */
/* r0 quotient */
/* r1 remainder  */
divisionpar10:
  /* r0 contains the argument to be divided by 10 */
    push {r2-r4}   /* save registers  */
    mov r4,r0
    mov r3,#0x6667   @ r3 <- magic_number  lower
    movt r3,#0x6666  @ r3 <- magic_number  upper
    smull r1, r2, r3, r0   @ r1 <- Lower32Bits(r1*r0). r2 <- Upper32Bits(r1*r0)
    mov r2, r2, ASR #2     /* r2 <- r2 >> 2 */
    mov r1, r0, LSR #31    /* r1 <- r0 >> 31 */
    add r0, r2, r1         /* r0 <- r2 + r1 */
    add r2,r0,r0, lsl #2   /* r2 <- r0 * 5 */
    sub r1,r4,r2, lsl #1   /* r1 <- r4 - (r2 * 2)  = r4 - (r0 * 10) */
    pop {r2-r4}
    bx lr                  /* leave function */


@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

for /l %%i in (1,1,5) do (
    SET line=
    for /l %%j in (1,1,%%i) do (
        SET line=!line!*
    )
    ECHO !line!
)

ENDLOCAL


get "libhdr"

let start() be
    for i = 1 to 5
    $(  for j = 1 to i do wrch('**')
        wrch('*N')
    $)


10 LET I% = 0
20 ' first iteration - before the WHILE
30 LET I% = I% + 1
40 PRINT I%
50 WHILE I% MOD 6 <> 0
60  LET I% = I% + 1
70  PRINT I%
80 WEND


LOCAL n := 0

DO WHILE .T.
   ? ++n
   IF n % 6 == 0
      EXIT
   ENDIF
ENDDO


import Data.List
import Control.Monad
import Control.Arrow

doWhile p f n = (n:) $ takeWhile p $ unfoldr (Just.(id &&& f)) $ succ n


x := 10
While (x >= 0)
{
  output .= "`n" . x
  x--
}
MsgBox % output


For each i from 10 to 0 by -1 do [Print: “i” ++ "\n";];


for i = 1; i <= 5; i++
    line = ""
    for (j = 1; j <= i; j++)
        line = line + "*"
    end
    print(line)
end


var val = 0;

do {
  val++;
  Sys.println(val);
} while( val % 6 != 0);


procedure main()

i := 0
repeat {
   write(i +:= 1)
   if i % 6 = 0 then break
   }
end


BEGIN {
  for(i=10; i>=0; i--) {
     print i
  }
}


FOR I = 10 TO 0 STEP -1 : PRINT I : NEXT I


@echo off
for /l %%D in (10,-1,0) do echo %%D


int val = 0;
do{
   val++;
   System.out.println(val);
}while(val % 6 != 0);


var val = 0;
do {
  print(++val);
} while (val % 6);


# Perform the action, then check the condition, etc
def do_while( action; condition ):
  def w: action | if (condition | not) then empty else ., w end;
  w;


julia> i = 0
0

julia> while true
           println(i)
           i += 1
           i % 6 == 0 && break
       end
0
1
2
3
4
5


>++++++++[-<++++++>]    //cell 0 now contains 48 the ASCII code for "0"
<+.-.                   //print the digits 1 and 0
>++++++++++.            //cell 1 now contains the carriage return; print it!
>+++++++++              //cell 2 now contains the number 9; this is our counter
<<+++++++++>>           //cell 0 now contains 57 the ASCII code for "9"
[<<.->.>-]              //print and decrement the display digit; print a newline; decrement the loop variable
<<.>.                   //print the final 0 and a final newline


using System;

class Program {
    static void Main(string[] args)
    {
        for (int i = 0; i < 5; i++)
        {
            for (int j = 0; j <= i; j++)
            {
                Console.Write("*");
            }
            Console.WriteLine();
        }
    }
}


// version 1.0.6

fun main(args: Array<String>) {
    var value = 0
    do {
        println(++value)
    }
    while (value % 6 != 0)
}


{def do_while
 {def do_while.r
  {lambda {:i}
   {if {= {% :i 6} 0}
    then :i (end of loop)
    else :i {do_while.r {+ :i 1}}}}}
 {lambda {:i}
  :i {do_while.r {+ :i 1}}}}
-> do_while

{do_while 0}
-> 0 1 2 3 4 5 6 (end of loop)


for (int i = 10; i >= 0; i--)
{
   Console.WriteLine(i);
}


for(int i = 0; i < 5; ++i) {
  for(int j = 0; j < i; ++j)
    std::cout.put('*');

  std::cout.put('\n');
}


shared void run() {

	for(i in 1..5) {
		for(j in 1..i) {
			process.write("*");
		}
		print("");
	}
}


for i in 1..5 {
        for 1..i do write('*');
        writeln();
}


a = 0
do
  a =a +1
  print a
loop until ( a mod 6) = 0


i = 0
repeat while TRUE
  i = i+1
  put i
  if i mod 6 = 0 then exit repeat
end


+ val : INTEGER;
{
  val := val + 1;
  val.print;
  '\n'.print;
  val % 6 != 0
}.while_do { };


repeat while n mod 6 is not 0 or n is 0
    add 1 to n
    put n
end repeat


   FOR i := 10 TO 0 STEP -1
      ? i
   NEXT


(doseq [x (range 10 -1 -1)] (println x))


Asterisks Omelette.

This recipe prints a triangle of asterisks.

Ingredients.
5 eggs
1 onion
1 potato
42 ml water
10 ml olive oil
1 garlic

Method.
Put eggs into the mixing bowl.
Fold onion into the mixing bowl.
Put eggs into the mixing bowl.
Add garlic into the mixing bowl.
Fold eggs into the mixing bowl.
Chop onion.
Put onion into the mixing bowl.
Fold potato into the mixing bowl.
Put olive oil into the mixing bowl.
Mash potato.
Put water into the mixing bowl.
Mash potato until mashed.
Chop onion until choped.
Pour contents of the mixing bowl into the baking dish.

Serves 1.


(doseq [i (range 5), j (range (inc i))]
  (print "*")
  (if (= i j) (println)))


start_up = proc ()
    po: stream := stream$primary_output()

    for i: int in int$from_to(1, 5) do
        for j: int in int$from_to(1, i) do
            stream$putc(po, '*')
        end
        stream$putl(po, "")
    end
end start_up


make "val 0
do.while [make "val :val + 1  print :val] [notequal? 0 modulo :val 6]
do.until [make "val :val + 1  print :val] [equal? 0 modulo :val 6]

to my.loop :n
  make "n :n + 1
  print :n
  if notequal? 0 modulo :n 6 [my.loop :n]
end
my.loop 0


i=0
repeat
  i=i+1
  print(i)
until i%6 == 0


Module checkit {
      x=0
      \\ Do or Repeat
      Do {
            x++
            Print x
      } Until x mod 6=0

      x=0
      {
            \\ when enter to block the loop flag change to false
            x++
            if x mod 6<>0 Then loop   ' set loop flag of current block to true
            \\ when block end check Loop flag and if true execute block again
            Print X
      }
}
Checkit


val := 0:
do
        val := 1 + val;
        print( val );
        if irem( val, 6 ) = 0 then
                break
        end if;
end do:


identification division.
program-id. countdown.
environment division.
data division.
working-storage section.
01	counter 		pic 99.
	88	counter-done	value 0.
01	counter-disp	pic Z9.
procedure division.
	perform with test after varying counter from 10 by -1 until counter-done
		move counter to counter-disp
		display counter-disp
	end-perform
	stop run.


# The more compact "array comprehension" style
console.log i for i in [10..0]

# The "regular" for loop style.
for i in [10..0]
	console.log i

# More compact version of the above
for i in [10..0] then console.log i


<cfloop index = "i" from = "10" to = "0" step = "-1">
  #i#
</cfloop>


(loop for i from 10 downto 1 do
  (print i))


       IDENTIFICATION DIVISION.
       PROGRAM-ID. Display-Triangle.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  Outer-Counter PIC 9.
       01  Inner-Counter PIC 9.

       PROCEDURE DIVISION.
       PERFORM VARYING Outer-Counter FROM 1 BY 1 UNTIL 5 < Outer-Counter

           PERFORM VARYING Inner-Counter FROM 1 BY 1
                   UNTIL Outer-Counter < Inner-Counter
               DISPLAY "*" NO ADVANCING
           END-PERFORM

           DISPLAY "" *> Output a newline
       END-PERFORM

       GOBACK
       .


<cfloop index = "i" from = "1" to = "5">
  <cfloop index = "j" from = "1" to = "#i#">
    *
  </cfloop>
  < br />
</cfloop>


value = 0;
While[
 value++;
 Print[value];
 Mod[value,6]!=0
]


   a=0;
   while (1)
      a = a+1;
      disp(a);
   if (~mod(a,6)) break; end;
   end;


block([n: 0], do (ldisp(n: n + 1), if mod(n, 6) = 0 then return('done)))$


a = 0
do
(
    print a
    a += 1
)
while mod a 6 != 0


LDA 28
SUB 29
STA 31
STA 28
BRZ 6 ;branch on zero to STP
JMP 0
STP
...
org 28
byte 11
byte 1
byte 0


10.step(to: 0, by: -1).each { |i|
    puts i
}


import std.stdio: writeln;

void main() {
    for (int i = 10; i >= 0; --i)
        writeln(i);
    writeln();

    foreach_reverse (i ; 0 .. 10 + 1)
        writeln(i);
}


c

[macro s(swap) - (a b : b a)]s.
[Sa Sb La Lb] ss

[macro d(2dup) - (a b : a b a b)]s.
[Sa d Sb La d Lb lsx] sd

[macro m(for) - ]s.
[lfx 1 - ldx !<m ] sm

0 10 ldx [p] sf !<m
q


(loop for i from 1 upto 5 do
  (loop for j from 1 upto i do
    (write-char #\*))
  (terpri))


Section FOR.
  Variable T : Type.
  Variable body : nat -> T -> T.
  Variable start : nat.

  Fixpoint for_loop n : T -> T :=
    match n with
    | O => fun s => s
    | S n' => fun s => for_loop n' (body (start + n') s)
    end.

End FOR.

Eval vm_compute in
  for_loop _
    (fun i =>
      cons
        (for_loop _
          (fun j => cons tt)
          0 (S i) nil
        )
    )
    0 5 nil.


include "cowgol.coh";

var i: uint8 := 1;
while i <= 5 loop
    var j: uint8 := 1;
    while j <= i loop
        print_char('*');
        j := j + 1;
    end loop;
    print_nl();
    i := i + 1;
end loop;


a := 0;
forever: show a; a := a + 1; exitif a mod 6 = 0; endfor
end


i = 0
' first iteration - before the While
i = i + 1
TextWindow.WriteLine(i)
While Math.Remainder(i, 6) <> 0
  i = i + 1
  TextWindow.WriteLine(i)
EndWhile


0 (dup 6 mod 0 == over 0 != and) 'pop (puts succ) () linrec


	.text
main:	li 	$s0, 0		# start at 0.
	li	$s1, 6
loop:	addi	$s0, $s0, 1	# add 1 to $s0
	div	$s0, $s1	# divide $s0 by $s1. Result is in the multiplication/division registers
	mfhi	$s3		# copy the remainder from the higher multiplication register to $s3
	move	$a0, $s0	# variable must be in $a0 to print
	li	$v0, 1		# 1 must be in $v0 to tell the assembler to print an integer
	syscall			# print the integer in $a0
	bnez	$s3, loop	# if $s3 is not 0, jump to loop

	li	$v0, 10
	syscall			# syscall to end the program


proc nonrec main() void:
    byte i;
    for i from 10 downto 0 do
        write(i," ")
    od
corp


for i in (0..10).descending() { println(i) }


1.upto(5) do |i|
  1.upto(i) do |j|
    print "*"
  end
  puts
end


import std.stdio: write, writeln;

void main() {
    for (int i; i < 5; i++) {
        for (int j; j <= i; j++)
            write("*");
        writeln();
    }
    writeln();

    foreach (i; 0 .. 5) {
        foreach (j; 0 .. i + 1)
            write("*");
        writeln();
    }
}


L(i) 1..10
   I i % 5 == 0
      print(i)
      L.continue
   print(i, end' ‘, ’)


MODULE DoWhile;
  IMPORT InOut;

  VAR
    i: INTEGER;

BEGIN
  i := 0;
  REPEAT
    INC(i);
    InOut.WriteInt(i, 1);
    InOut.WriteLn;
  UNTIL i MOD 6 = 0;
END DoWhile.


REPEAT
  i := i + 1;
  IO.Put(Fmt.Int(i));
UNTIL i MOD 6 = 0;


stuzzica
    ...     # loop body
e brematura anche, se <expr> # exit if <expr> is false


DOWHILELOOP
    set val = 0
    do {
        set val = val + 1
        write val,!
    } while ((val # 6) '= 0)

    quit


(for ((longtemps-je-me-suis-couché-de-bonne-heure (in-range 10 -1 -1)))
     (write longtemps-je-me-suis-couché-de-bonne-heure))
    → 10 9 8 7 6 5 4 3 2 1 0


[ Loop with downward counter
  ==========================

  A program for the EDSAC

  Prints the integers 10 down to 0

  The counter is stored at address [email protected]

  Its initial value is 9 * 2^12
  (9 in the high 5 bits, representing
  the character '9') and it counts
  down in steps of 2^12

  Works with Initial Orders 2 ]

        T56K    [ set load point ]
        GK      [ set base address ]

[ orders ]

        [email protected]    [ print figure shift ]
        [email protected]    [ print '1' ]
        [email protected]    [ print '0' ]
        [email protected]    [ print CR ]
        [email protected]    [ print LF ]

[ 5 ]   [email protected]    [ print c ]
        [email protected]    [ print CR ]
        [email protected]    [ print LF ]

        [email protected]    [ acc := 0 ]
        [email protected]    [ acc += c ]
        [email protected]    [ acc -:= character '1' ]
        [email protected]    [ c := acc ]

        [email protected]     [ branch on non-negative ]

        ZF      [ stop ]

[ constants ]

[ 14 ]  #F      [ πF -- figure shift ]
[ 15 ]  QF      [ character '1' ]
[ 16 ]  PF      [ character '0' ]
[ 17 ]  @F      [ θF -- CR ]
[ 18 ]  &F      [ ΔF -- LF ]

[ variables ]

[ 19 ]  P0F     [ used to clear acc ]
[ 20 ]  OF      [ character c = '9' ]

        EZPF    [ start when loaded ]


for ( i int from 10 to 0 decrement by 1 )
   SysLib.writeStdout( i );
end


open monad io

each [] = do return ()
each (x::xs) = do
  putStrLn $ show x
  each xs

each [10,9..0] ::: IO


for( i = 1 : 5 ){
    for( j = 1 : i ) io.write( '*' )
    io.writeln()
}


[
 [*]P		[print asterisk]sz
 lj 1 + d sj	[increment j, leave it on stack]sz
 li !<A		[continue loop if i >= j]sz
]sA
[
 1 d sj		[j = 1, leave it on stack]sz
 li !<A		[enter loop A if i >= j]sz
 [
]P		[print newline]sz
 li 1 + d si	[increment i, leave it on stack]sz
 5 !<B		[continue loop if 5 >= i]sz
]sB
1 d si		[i = 1, leave it on stack]sz
5 !<B		[enter loop B if 5 >= i]sz


*        Loops/Continue            12/08/2015
LOOPCONT CSECT
         USING  LOOPCONT,R12
         LR     R12,R15
BEGIN    LA     R8,0
         SR     R5,R5
         LA     R6,1
         LA     R7,10
LOOPI    BXH    R5,R6,ELOOPI       for i=1 to 10
         LA     R3,MVC(R8)
         XDECO  R5,XDEC
         MVC    0(4,R3),XDEC+8
         LA     R8,4(R8)
         LR     R10,R5
         LA     R1,5
         SRDA   R10,32
         DR     R10,R1
         LTR    R10,R10
         BNZ    COMMA
         XPRNT  MVC,80
         LA     R8,0
         B      NEXTI
COMMA    LA     R3,MVC(R8)
         MVC    0(2,R3),=C', '
         LA     R8,2(R8)
NEXTI    B      LOOPI              next i
ELOOPI   XR     R15,R15
         BR     R14
MVC      DC     CL80' '
XDEC     DS     CL16
         YREGS
         END    LOOPCONT


with Ada.Text_IO;
use Ada.Text_IO;

procedure Loop_Continue is
begin
        for I in 1..10 loop
                Put (Integer'Image(I));
                if I = 5 or I = 10 then
                        New_Line;
                        goto Continue;
                end if;
                Put (",");
                <<Continue>>  --Ada 2012 no longer requires a statement after the label
        end loop;
end Loop_Continue;


for i to 10 do
    write( i );
    if i % 5 = 0
    then write( "\n" )
    else write( ", " )
    fi
od


foreach i 1..10 {
    print (i)
    if ((i % 5) == 0) {
        println()
        continue
    }
    print (", ")
}


/**
 Loops/Do-while in Neko
 Tectonics:
   nekoc loops-do-while.neko
   neko loops-do-while
*/

var index = 0;
do {
  index += 1;
  $print(index, "\n");
} while (index % 6) != 0


mutable x = 0;
do
{
    x++;
    WriteLine($"$x");
} while (x % 6 != 0)


/* NetRexx */
options replace format comments java crossref savelog symbols nobinary

  say
  say 'Loops/Do-while'

  i_ = 0
  loop until i_ // 6 = 0
    i_ = i_ + 1
    say i_
    end


%% Implemented by Arjun Sunel
-module(downward_loop).
-export([main/0]).

main() ->
	for_loop(10).

 for_loop(N) ->
 	if N > 0 ->
		io:format("~p~n",[N] ),
		for_loop(N-1);
	true ->
		io:format("~p~n",[N])
	end.


   FOR I%=10 TO 0 STEP -1 DO
     PRINT(I%)
   END FOR


for i = 10 to 0 by -1 do
    ? i
end for


program LoopFor;

{$APPTYPE CONSOLE}

var
  i, j: Integer;
begin
  for i := 1 to 5 do
  begin
    for j := 1 to i do
      Write('*');
    Writeln;
  end;
end.


set_ns(rosettacode);

add_var({str},s)_value();
add_var({str},output);

add_for({int},i)_from(1)_uptoand(5)_inc()
    with_var(s)_v();
    add_for({int},j)_from(0)_upto([i])_inc()
        with_var(s)_calc([s]&="*");
    ;
    with_var(output)_calc(&=[s]&\n);
;

me_msg([output]);

reset_ns[];


 begin
   integer i;
   for i:=1 step 1 until 10 do begin
     outinteger(i);
     if i=(i div 5)*5 then
       outimage
     else
       outstring(", ")
     end
 end


FOR i FROM 1 TO 10 DO
  print ((i,
    IF i MOD 5 = 0 THEN
      new line
    ELSE
      ","
    FI
  ))
OD


begin
    i_w := 1; s_w := 0; % set output format %
    for i := 1 until 10 do begin
        writeon( i );
        if i rem 5 = 0
        then write()
        else writeon( ", " )
    end for_i
end.


set table to {return}
repeat with i from 1 to 10
	if i < 5 or (i ≥ 6 and i < 10) then
		set end of table to i & ", "
	else if i = 5 or i = 10 then
		set end of table to i & return
	end if
end repeat
return table as string


var val = 0
while true:
  inc val
  echo val
  if val mod 6 == 0: break


10 PRINT "NO,"A" ISN'T A MULTIPLE OF 6."
20 A=A+1
30 IF A-(A/6)*6<>0 THEN GOTO 10
40 PRINT "YES, 6 IS A MULTIPLE OF 6."


MODULE LoopDoWhile;
IMPORT
  Out;

PROCEDURE Do();
VAR
  i: INTEGER;
BEGIN
  i := 0;
  REPEAT
    Out.LongInt(i,0);Out.Ln;
    INC(i)
  UNTIL (i MOD 6 = 0);
END Do;

BEGIN
  Do
END LoopDoWhile.


class DownwardFor
{
  public static Void main ()
  {
    for (Int i := 10; i >= 0; i--)
    {
      echo (i)
    }
  }
}


#APPTYPE CONSOLE

FOR DIM i = 10 DOWNTO 0
    PRINT i
NEXT

PAUSE


fun for -> var, test, body, return    # define a for loop using recursion
(
   test(var) -> continue
   if (continue) ->
   (
      body(var) -> var
      for (var, test, body, return)
   )
   |
      return(var)
)
| for

fun upToFive (-> index, return) '<='(index, 5, return) | upToFive

for (1, upToFive) -> index, return
(
   fun countTheStars -> stars, return
   (
      'count'(stars) -> n
      '<'(n, index, return)   # continue until n = index
   )
   | countTheStars

   for ("*", countTheStars) -> prefix, return
      'str'(prefix, "*", return)
   | stars

   println(stars) ->

   'inc'(index, return)
)
| result
exit()


proc nonrec main() void:
    byte i,j;
    for i from 1 upto 5 do
        for j from 1 upto i do
            write("*")
        od;
        writeln()
    od
corp


loop 1..10 'i [
    prints i
    if 0 = i%5 [
        print ""
        continue
    ]
    prints ", "
]


for(int i = 1; i <= 10; ++i) {
  write(i, suffix=none);
  if(i % 5 == 0) {
    write("");
    continue;
  } else {
    write(", ", suffix=none);
  }
}


Loop, 10 {
  Delimiter := (A_Index = 5) || (A_Index = 10) ? "`n":", "
  Index .= A_Index . Delimiter
}
MsgBox %Index%


let rec loop i =
  let i = succ i in
  Printf.printf "%d\n" i;
  if i mod 6 <> 0 then
    loop i
  in
  loop 0


val = 0;
do
  val++;
  disp(val)
until( mod(val, 6) == 0 )


0 doWhile: [ 1+ dup . dup 6 rem 0 <> ] drop


DEFINE VARIABLE ii AS INTEGER.

DO WHILE ii MODULO 6 <> 0 OR ii = 0:
   ii = ii + 1.
   MESSAGE ii VIEW-AS ALERT-BOX.
END.


for i in [10, 9 .. 0] do
    Print(i, "\n");
od;


var i, j : Integer;

for i := 1 to 5 do begin
   for j := 1 to i do
      Print('*');
   PrintLn('');
end;


for i in 1..5 {
    for _ in 1..i {
        print("*", terminator: "")
    }
    print()
}


for width in 1..5 {
    for _ in 1..width {
        print("*")
    }
    println()
}


BEGIN {
  for(i=1; i <= 10; i++) {
    printf("%d", i)
    if ( i % 5 == 0 ) {
      print
      continue
    }
    printf(", ")
  }
}


 10  FOR I = 1 TO 10
 20  PRINT I;
 30  IF I -  INT (I / 5) * 5 = 0 THEN  PRINT : GOTO 50"CONTINUE
 40  PRINT ", ";
 50  NEXT


for (i = 1; i <= 10; i++) {
	print i
	if (i % 5) {
		print ", "
		continue
	}
	print "\n"
}
quit


declare
  I = {NewCell 0}
in
  for until:@I mod 6 == 0 do
     I := @I + 1
     {Show @I}
  end


x = 0;
while(1,
  print(x++);
 if(x % 6 == 0, break)
)


program countto6(output);

var
  i: integer;

begin
  i := 0;
  repeat
    i := i + 1;
    writeln(i)
  until i mod 6 = 0
end.


my $val = 0;
do {
   $val++;
   print "$val\n";
} while ($val % 6);


for(i = 10; i >= 0; i -= 1)
    show_message(string(i))


for i := 10; i >= 0; i-- {
  fmt.Println(i)
}


for i range 5
  for j range i
    write "*"
  .
  print ""
.


[ Loops
  =====

  A program for the EDSAC

  Demonstrates nested loops
  and printer output

  Works with Initial Orders 2 ]

        T56K  [ set load point  ]
        GK    [ set theta       ]

        [email protected]  [ figure shift    ]

[  1 ]  [email protected]  [ a = 0           ]
        [email protected]  [ a = i           ]

[  3 ]  [email protected]  [ j = a; a = 0    ]
        [email protected]  [ write character ]
        [email protected]  [ a = j           ]
        [email protected]  [ a -= 1          ]
        [email protected]  [ j = a           ]
        [email protected]   [ if a>=0 go to 3 ]

        [email protected]  [ write line feed ]
        [email protected]  [ a = 0           ]
        [email protected]  [ a = i           ]
        [email protected]  [ a += 1          ]
        [email protected]  [ i = a           ]
        [email protected]  [ a -= 5          ]
        [email protected]   [ if a<0 go to 1  ]

        ZF    [ halt            ]

[ 17 ]  P0D   [ const: 1        ]
[ 18 ]  P2D   [ const: 5        ]

[ 19 ]  P0F   [ var: i          ]
[ 20 ]  P0F   [ var: j          ]

[ 21 ]  #F    [ figure shift    ]
[ 22 ]  ZF    [ '+' character   ]
[ 23 ]  &F    [ line feed       ]

[ 24 ]  P0F   [ used to clear a ]

        EZPF  [ begin execution ]


str string;
for ( i int to 5 )
   str = "";
   for ( j int to i )
      str += "*";
   end
   SysLib.writeStdout(str);
end


using System;

class Program {
    static void Main(string[] args) {
        for (int i = 1; i <= 10; i++) {
            Console.Write(i);

            if (i % 5 == 0) {
                Console.WriteLine();
                continue;
            }

            Console.Write(", ");
        }
    }
}


integer x = 0
while 1 do
    x += 1
    ?x
    if mod(x,6)=0 then exit end if
end while


var i = 0;
do {
	i = i::inc;
	printf("%i\n", i);
} while (i%6 != 0);


$val = 0;
do {
   $val++;
   print "$val\n";
} while ($val % 6 != 0);


go =>
  N = 0,
  do
     N := N+1,
     println(N)
  while (N mod 6 != 0).


import Control.Monad

main :: IO ()
main = forM_ [10,9 .. 0] print


class Step {
  var end:Int;
  var step:Int;
  var index:Int;

  public inline function new(start:Int, end:Int, step:Int) {
    this.index = start;
    this.end = end;
    this.step = step;
  }

  public inline function hasNext() return step > 0 ? end >= index : index >= end;
  public inline function next() return (index += step) - step;
}

class Main {
  static function main() {
    for (i in new Step(10, 0, -1)) {
      Sys.print('$i ');
    }
  }
}


for let i 10; i >= 0; i--
  println i
endfor


open monad io

loop m n | n < m = do
            loop' n 0
            putStrLn ""
            loop m (n + 1)
         | else = do return ()
          where loop' m n | n <= m = do
                              putStr "*"
                              loop' m (n + 1)
                          | else = do return ()

_ = loop 10 1 ::: IO


import extensions;

public program()
{
    for(int i := 0, i < 5, i += 1)
    {
        for(int j := 0, j <= i, j += 1)
            { console.write:"*" };

        console.writeLine()
    }
}


defmodule Loops do
  def loops_for(n) do
    Enum.each(1..n, fn i ->
      Enum.each(1..i, fn _ -> IO.write "*" end)
      IO.puts ""
    end)
  end
end

Loops.loops_for(5)


for(int i = 1;i <= 10; i++){
   cout << i;
   if(i % 5 == 0){
      cout << endl;
      continue;
   }
   cout << ", ";
}


for i in 1..10 {
        write(i);
        if i % 5 == 0 then {
                writeln();
                continue;
        }
        write(", ");
}


FOR i := 1 TO 10
   ?? i
   IF i % 5 == 0
      ?
      LOOP
   ENDIF
   ?? ", "
NEXT


(doseq [n (range 1 11)]
  (print n)
  (if (zero? (rem n 5))
      (println)
      (print ", ")))


(let Val 0
   (loop
      (println (inc 'Val))
      (T (=0 (% Val 6))) ) )


int main(){
   int value = 0;
   do {
      value++;
      write(value + "\n");
   } while (value % 6);
}


dcl value fixed bin (31) init (0);
do forever;
  value = value + 1;

  if mod(value, 6) = 0 then
    leave;

  put list (value);
end;


To run:
Start up.
Demonstrate do-while.
Wait for the escape key.
Shut down.

To demonstrate do-while:
Bump a counter.
Convert the counter to a string.
Write the string on the console.
If the counter is evenly divisible by 6, exit.
Repeat.


every i := 10 to 0 by -1 do {
   # things to do within the loop
   }


%% Implemented by Arjun Sunel
-module(nested_loops).
-export([main/0, inner_loop/0]).

main() ->
	outer_loop(1).

inner_loop()->
	inner_loop(1).

inner_loop(N) when N rem 5 =:= 0 ->
	io:format("* ");

inner_loop(N) ->
	io:fwrite("* "),
	inner_loop(N+1).

outer_loop(N) when N rem 5 =:= 0 ->
	io:format("*");

outer_loop(N) ->
	outer_loop(N+1),
	io:format("~n"),
	inner_loop(N).


FOR I=1 TO 5 DO
    FOR J=1 TO I DO
        PRINT("*";)
    END FOR
    PRINT
END FOR


       IDENTIFICATION DIVISION.
       PROGRAM-ID. loop-continue.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  i PIC 99.

       PROCEDURE DIVISION.
           PERFORM VARYING i FROM 1 BY 1 UNTIL 10 < i
               DISPLAY i WITH NO ADVANCING

               IF FUNCTION MOD(i, 5) = 0
                   DISPLAY SPACE
                   EXIT PERFORM CYCLE
               END-IF

               DISPLAY ", " WITH NO ADVANCING
           END-PERFORM

           GOBACK
           .


<cfscript>
  for( i = 1; i <= 10; i++ )
  {
    writeOutput( i );
    if( 0 == i % 5 )
    {
      writeOutput( "< br />" );
      continue;
    }
    writeOutput( "," );
  }
</cfscript>


(do ((i 1 (1+ i)))
    ((> i 10))
  (format t "~a~:[, ~;~%~]" i (zerop (mod i 5))))

(do ((i 1 (1+ i)))
    ((> i 10))
  (write i)
  (when (zerop (mod i 5))
    (terpri)
    (go end))
  (write-string ", ")
  end)

(do ((i 1 (1+ i)))
    ((> i 10))
  (write i)
  (if (zerop (mod i 5))
    (terpri)
    (write-string ", ")))


lvars val = 0;
while true do
   val + 1 -> val;
   printf(val, '%p\n');
   quitif(val rem 6 = 0);
endwhile;


% initial condition
do(0):- write(0),nl,do(1).

% control condition
do(V):- 0 is mod(V,6), !, fail.

% loop
do(V) :-
    write(V),nl,
    Y is V + 1,
    do(Y).

wloop :-
   do(0).


for (int i = 10; i >= 0; i--) {
    System.out.println(i);
}


for i = 1 to 5 do
    for j = 1 to i do
        puts(1, "*") -- Same as "puts(1, {'*'})"
    end for
    puts(1, "\n") -- Same as "puts(1, {'\n'})"
end for


#light
[<EntryPoint>]
let main args =
    for i = 1 to 5 do
        for j = 1 to i do
            printf "*"
        printfn ""
    0


import std.stdio;

void main() {
    foreach (i; 1 .. 11) {
        write(i);
        if (i % 5 == 0) {
            writeln();
            continue;
        }
        write(", ");
    }
}


1 si		# i = 1
[2Q]sA		# A = code to break loop
[[, ]P 1J]sB	# B = code to print comma, continue loop
[
 li n		# print i
 li 5 % 0 !=B	# call B if i % 5
 [
]P              # print newline
 M		# mark from calling B
 li 1 + si	# i += 1
 li 10!<C	# continue loop if 10 >= i
]sC li 10!<C	# enter loop if 10 >= i


program DoLoop(output);
var
  i: integer;
begin
  for i := 1 to 10 do
  begin
    write(i);
    if i mod 5 = 0 then
    begin
      writeln;
      continue;
    end;
    write(', ');
  end;
end.


var i : Integer;

for i := 1 to 10 do begin
   Print(i);
   if i mod 5 = 0 then begin
      PrintLn('');
      continue;
   end;
   Print(', ');
end;


val = 0
while True:
   val +=1
   print val
   if val % 6 == 0: break


DO
    PRINT n
    n = n + 1
LOOP WHILE n MOD 6 <> 0


0 [ 1+ dup echo cr
    dup 6 mod 0 = until ] drop


i <- 0
repeat
{
   i <- i + 1
   print(i)
   if(i %% 6 == 0) break
}


// version 1.3.61

fun main() {
    (10 downTo 0).forEach { println(it) }
}


{def downward_for
 {lambda {:i}
   {if {< :i 0}
    then (end of loop)
    else :i {downward_for {- :i 1}}}}}
-> downward_for

{downward_for 10}
-> 10 9 8 7 6 5 4 3 2 1 0 (end of loop)


class ForLoops
{
  public static Void main ()
  {
    for (Int i := 1; i <= 5; ++i)
    {
      for (Int j := 1; j <= i; ++j)
      {
         Env.cur.out.print ("*")
      }
      Env.cur.out.printLine ("")
    }
  }
}


for i in 1..10 {
    print(i, terminator: "")
    if i % 5 == 0 {
        print()
        continue
    }
    print(", ", terminator: "")
}


open monad io

loop n =
  if n > 10 then do
      return ()
    else do
      putStr (show n)
      putStr f
      loop (n + 1)
  where f | n % 5 == 0 = "\r\n"
          | else = ", "

_ = loop 1 ::: IO


defmodule Loops do
  def continue do
    Enum.each(1..10, fn i ->
      IO.write i
      IO.write if rem(i,5)==0, do: "\n", else: ", "
    end)
  end
end

Loops.continue


%% Implemented by Arjun Sunel
-module(continue).
-export([main/0, for_loop/1]).

main() ->
	for_loop(1).

for_loop(N)  when N /= 5 , N <10 ->
	io:format("~p, ",[N] ),
	for_loop(N+1);

for_loop(N) when N >=10->
	if N=:=10 ->
		io:format("~p\n",[N] )
	end;

for_loop(N) ->
	if N=:=5 ->
		io:format("~p\n",[N] ),
		for_loop(N+1)
	end.


#lang racket
(let loop ([n 0])
  (let ([n (add1 n)])
    (displayln n)
    (unless (zero? (modulo n 6)) (loop n))))


my $val = 0;
repeat {
    say ++$val;
} while $val % 6;


rebol [
	Title: "Loop/While"
	URL: http://rosettacode.org/wiki/Loop/Do_While
]

; REBOL doesn't have a specific 'do/while' construct, but 'until' can
; be used to provide the same effect.

value: 0
until [
	value: value + 1
	print value

	0 = mod value 6
]


Red []
i: 0
until [
  ?? i
  i: i + 1
  i % 6 = 0 ;; loop , until this is true...
]


/*REXX program demonstrates a     DO  UNTIL     construction.           */
v=0
          do  until  v//6==0           /*REXX   //   is the ÷ remainder.*/
          v=v+1
          say v
          end
                                       /*stick a fork in it, we're done.*/


repeat with i = 10 down to 0
  put i
end repeat


10.downto 0 do { i : INTEGER;
  i.println;

};


local x=10
repeat for 10 times
  put x & return
  add -1 to x
end repeat


(for [i 1 4]
  (for [j 1 i]
    (io.write "*"))
  (print))


for i = 1 to 5 do for j = 1 to i do !'*'; od; !; od


FOR I=1 TO 10 DO
   PRINT(I;CHR$(29);)  ! printing a numeric value leaves a blank after it
                       ! chr$(29) delete it.....
   IF I MOD 5=0 THEN
      PRINT
      CONTINUE FOR
   END IF
   PRINT(",";)
END FOR
PRINT


include std\console.e --only for any_key to make running command window easier on windows

for i = 1 to 10 do
    if remainder(i,5) = 0 then
        printf(1, "%d\n", i)
        else
            printf(1,"%d, ", i)
            continue
    end if
end for
any_key()


for i in 1 .. 10 do
  printf "%d" i
  if i % 5 = 0 then
    printf "\n"
  else
    printf ", "


1 10 [a,b] [
    [ number>string write ]
    [ 5 mod 0 = "\n" ", " ? write ] bi
] each


   n = 0
   While True
      n++  See n + nl
      if n % 6 = 0  exit ok
   end


let mut x = 0;

loop {
    x += 1;
    println!("{}", x);

    if x % 6 == 0 { break; }
}


variable x := 0;
do
  {
    ++x;
    x!
  }
while (x % 6 != 0);


/* using DO UNTIL so that the loop executes at least once */
data _null_;
n=0;
do until(mod(n,6)=0);
    n+1;
    put n;
end;
run;


for i from 10 to 0 by -1 do print(i) end:


: triangle ( n -- )
  1+ 1 do
    cr i 0 do [char] * emit loop
  loop ;
5 triangle


C     WARNING: This program is not valid ANSI FORTRAN 77 code. It uses
C     one nonstandard character on the line labelled 5001. Many F77
C     compilers should be okay with it, but it is *not* standard.
      PROGRAM FORLOOP
        INTEGER I, J

        DO 20 I = 1, 5
          DO 10 J = 1, I
C           Print the asterisk.
            WRITE (*,5001) '*'
   10     CONTINUE
C         Print a newline.
          WRITE (*,5000) ''
   20   CONTINUE

        STOP

 5000   FORMAT (A)
C       Standard FORTRAN 77 is completely incapable of completing a
C       WRITE statement without printing a newline. If you wanted to
C       write this program in valid F77, you would have to come up with
C       a creative way of printing varying numbers of asterisks in a
C       single write statement.
C
C       The dollar sign at the end of the format is a nonstandard
C       character. It tells the compiler not to print a newline. If you
C       are actually using FORTRAN 77, you should figure out what your
C       particular compiler accepts. If you are actually using Fortran
C       90 or later, you should replace this line with the commented
C       line that follows it.
 5001   FORMAT (A, $)
C5001   FORMAT (A, ADVANCE='NO')
      END


' FB 1.05.0 Win64

For i As Integer = 1 To 5
  For j As Integer = 1 To i
    Print "*";
  Next
  Print
Next

Sleep


class LoopsContinue
{
  public static Void main ()
  {
    for (Int i := 1; i <= 10; ++i)
    {
      Env.cur.out.print (i)
      if (i % 5 == 0)
      {
        Env.cur.out.printLine ("")
        continue
      }
      Env.cur.out.print (", ")
    }
    Env.cur.out.printLine ("")
  }
}


: main
  11 1 do
    i dup 1 r.
    5 mod 0= if cr else [char] , emit space then
  loop ;


do i = 1, 10
   write(*, '(I0)', advance='no') i
   if ( mod(i, 5) == 0 ) then
      write(*,*)
      cycle
   end if
   write(*, '(A)', advance='no') ', '
end do


include "NSLog.incl"

long num

for num = 1 to 10
  if ( num mod 5 )
    NSLog(@"%ld, \b",num)
  else
    NSLog(@"%ld",num)
  end if
next

HandleEvents


Public Sub Main()
Dim siCount As Short

For siCount = 1 To 10
  Print siCount;
  If siCount <> 5 And siCount <> 10 Then Print ",";
  If siCount = 5 Then Print gb.NewLine;
Next

End


class MAIN is
  main is
    val ::= 0;
    loop
      val := val + 1;
      #OUT + val + "\n";
      while!(val % 6 /= 0)
    end;
  end;
end;


  {
    var (x, l) = (0, List[Int]())
    do {
      x += 1
      l :+= x // A new copy of this list with List(x) appended.
    } while (x % 6 != 0)
    l
  }.foreach(println(_))


(let loop ((i 1))
  (display i)
  (if (positive? (modulo i 6))
      (loop (+ i 1))))


v=0
while %T
    v=v+1
    printf("%2d ",v)
    if modulo(v,6)==0 then break; end
end
printf("\n")


for i from 10 thru 0 step -1 do print(i);


:- module loops_downward_for.
:- interface.

:- import_module io.
:- pred main(io::di, io::uo) is det.

:- implementation.
:- import_module int.

main(!IO) :-
   Print = (pred(I::in, !.IO::di, !:IO::uo) is det :-
       io.write_int(I, !IO), io.nl(!IO)
   ),
   int.fold_down(Print, 1, 10, !IO).


for i = 10 step -1 until 0: show i; endfor
end


10 :n (n 0 >=) (n puts! n pred @n) while


for i in range(10, 0)
    print i
end for


for n = 1 to 5
{
   for a = 1 to n
      print["*"]

   println[]
}


fun main(n: int): [n]int =
  loop (a = replicate n 0) = for i < n do
    (loop (s = 0) = for j < i+1 do
     s + j
     let a[i] = s
     in a)
  in a


window 1

long i, j

for i = 1 to 5
  for j = 1 to i
    print @"*";
  next
  print
next

HandleEvents