fortest.frink

View or download fortest.frink in plain text format


println["Counting up"]
for i = 1 to 10 step 1/2
   println[i]

println["\nCounting down"]
for i = 10 to 1 step -2
   println[i]

// Nested loops
println["\nNested loops"]
for i = 1 to 4
   for j = 1 to 4
      println[i + " " + j]

println["\nRunning timing loops..."]

for iter = 1 to 5
{
   start = now[]

   // Timing
   limit = 100 million
   for i = 1 to limit
   {
   }

   end = now[]
   println["Iteration $iter:"]
   println["The loop took " + (end - start -> seconds) + " seconds."]
   println["This is " + (limit / (end-start) -> s^-1) + " operations/sec."]
}


View or download fortest.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 17592 days, 15 hours, 47 minutes ago.