Task

Show the following output using one loop.

1, 2, 3, 4, 5
6, 7, 8, 9, 10



Try to achieve the result by forcing the next iteration within the loop
upon a specific condition, if your language allows it.



Related tasks

   Loop over multiple arrays simultaneously
   Loops/Break
   Loops/Continue
   Loops/Do-while
   Loops/Downward for
   Loops/For
   Loops/For with a specified step
   Loops/Foreach
   Loops/Increment loop index within loop body
   Loops/Infinite
   Loops/N plus one half
   Loops/Nested
   Loops/While
   Loops/with multiple ranges
   Loops/Wrong ranges


 
Module Checkit {
      \\ A For {} loop
      For i=1 to 10 {
            Print i;
            if i mod 5 Else Print : continue
            Print ",";
      }
      Print i=11
      \\ A For Next loop
      For i=1 to 10
            Print i;
            if i mod 5 Else Print : continue
            Print ",";
      Next i
      Print i=11
      \\ A for loop using  a block and a Loop statement
      i=0
      {     i++
            if i>10  then Exit
            loop
            Print i;
            if i mod 5 Else Print : continue
            Print ",";
       }
      Print i=11
      \\ as above but end value for i=10 not 11
      i=0
      {     i++
            if i<10  then loop
            Print i;
            if i mod 5 Else Print : continue
            Print ",";
       }
      Print i=10  ' not 11 but 10
}
Checkit
 