multifortest.frink

View or download multifortest.frink in plain text format


println["This should not print anything:"]
multifor [a,b] = [1 to 0, 3 to 4]
   println["$a $b"]
println[]

multifor [a] = [0 to 2]
   println[a]
println[]

multifor a = [0 to 2]
   println[a]
println[]


// Assigning to named variables
println["1 to 2,  3 to 4"]
multifor [a,b] = [1 to 2, 3 to 4]
   println["$a $b"]
println[]

// Returning an array
println["1 to 2,  3 to 4"]
multifor a = [1 to 2, 3 to 4]
   println[a]
println[]

// Test of undefined formal parameter.
multifor [a,b,c] = [1 to 2, 3 to 4]
   println["$a $b $c"]
println[]

// Test of unused formal parameter
multifor [a] = [1 to 2, 3 to 4]
   println["$a"]
println[]

// Test arbitrarily-sized loop.
bounds = makeArray[[4], new range[1,2]]
multifor [a,b,c,d] = bounds
   println["$a $b $c $d"]
println[]

upper = 2
bounds = makeArray[[8], noEval[1 to upper]]
multifor d = bounds
   println[d]
println[]

chars = ["A", "B", "C"]
multifor e = makeArray[[3], chars]
   println[e]
println[]

// Triangular range.
m = makeArray[[10,10],0]
multifor [i,j] = [new range[0,9], new range[i,9]]
   m@i@j = i+j+1
println[join["\n",m]]
println[]

multifor [a, b, c] = [1 to 2, 1 to 3, 1 to 5]
 println["$a $b $c"]
println[]


// Triangular
multifor [f,g] = [new range[1,3], new range[f+1,4]]
   println["$f $g"]
println[]

// Triangular in 3 dimensions
multifor [f,g, h] = [new range[1,3], new range[f+1,4], new range[g+1,5]]
   println["$f $g $h"]
println[]


View or download multifortest.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 was born 17590 days, 6 hours, 45 minutes ago.