Author Topic: Cool For/Next  (Read 1854 times)

0 Members and 1 Guest are viewing this topic.

Aaron

  • Guest
Cool For/Next
« on: February 26, 2014, 11:41:05 AM »
Hi,

This is a great feature:
Code: [Select]
sys i, j=1
Dim a(5) As sys

For i=0, 100, 25  '<-  almost LUA SCRIPT!
    a(j) = i
    j +=1
Next

print a(1) + ":" + a(2) + ":" +  a(3) + ":" + a(4) + ":" + a(5)

Charles Pegge

  • Guest
Re: Cool For/Next
« Reply #1 on: February 26, 2014, 01:09:39 PM »
I'm not familiar with LUA but we can, if so desired, make this code a little shorter with a few more tricks :)

Code: [Select]
sys i,j=1,a[5]
for i=0, 100, 25 { a[j++]=i }
def c ":"
print a(1)  c  a(2)  c   a(3)  c  a(4)  c  a(5)