multifortest3.frink

Download or view multifortest3.frink in plain text format

/*   
  This demonstrates that a multifor loop will stop as soon as a loop at any
  level has a null or inverted range, while the same loops nested manually
  will continue the outer loops.
*/


junk = 0
multifor [fa, fb, fc] = [new range[2, 6, 2], new range[fa+1, 16, 3], new range[fa+fb, 13, 3] ]
{
  junk = junk + 1 
  println["[$fa, $fb, $fc] $junk"]
}
println[]

junk = 0
for fa = new range[2, 6, 2]
{
  for fb = new range[fa+1, 16, 3]
  {
    for fc = new range[fa+fb, 13, 3]
    {
      junk = junk + 1 
      println["[$fa, $fb, $fc] $junk"]
    }
  }
}
println[]

/*
[2, 3, 5] 1
[2, 3, 8] 2
[2, 3, 11] 3
[2, 6, 8] 4
[2, 6, 11] 5
[2, 9, 11] 6

[2, 3, 5] 1
[2, 3, 8] 2
[2, 3, 11] 3
[2, 6, 8] 4
[2, 6, 11] 5
[2, 9, 11] 6
[4, 5, 9] 7
[4, 5, 12] 8
[4, 8, 12] 9
[6, 7, 13] 10
*/


Download or view multifortest3.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen, eliasen@mindspring.com