Saturday 8 February 2014

Case-x Value of i never end

GraphicsWindow.MouseDown = md
i = 0
loopz:
TextWindow.WriteLine(i)
Program.Delay(100)
i = i + 1
Goto loopz


Sub md
  For j = 0 To10
    TextWindow.WriteLine("yoyo hakusho")
    Program.Delay(1000)
  EndFor
EndSub

Just paste above code and run, klik your mouse on the graphic screen

Above versus below

GraphicsWindow.MouseDown = md
i = 0
loopz:
TextWindow.WriteLine("i " + i + " j :" + j)
Program.Delay(100)
i = i + 1
Goto loopz


Sub md
  For j = 0 To i
    TextWindow.WriteLine("yoyo hakusho")
    Program.Delay(1000)
  EndFor
EndSub

Finally, added: a = i,  value of i should rest in peace now, in variable a (Loop don't use variable i anymore)

GraphicsWindow.MouseDown = md
i = 0
aloha = Shapes.AddEllipse(10,10)
loopz:
TextWindow.WriteLine("i " + i + " j :" + j + Clock.time)
Program.Delay(1000)
i = i + 1
Goto loopz


Sub md
  a = i
  For j = 0 To i
    TextWindow.WriteLine("yoyo hakusho" + Clock.time)
    Program.Delay(1000)
  EndFor
EndSub

So again, the conclusion: the sub is obey what he told to do.

No comments:

Post a Comment