Jumat, 03 April 2020

SMALL BASIC: Controlling main program loop from sub

Hi, SMALL BASIC programmer, welcome.

In this tutorial, we will discussed how to control main program's loop from sub.

At first, the loop will be triggered with the click mouse and the stop it with click mouse, on and on.

The code example is below:

GraphicsWindow.Show()
GraphicsWindow.MouseDown = md
x = 0

loopz:

While x <> 0
TextWindow.WriteLine(x)
endwhile

Goto loopz


Sub md
  If x = 0 Then
    x = 1
  Else
    x = 0
  EndIf
  TextWindow.WriteLine(x)
EndSub
  

Tidak ada komentar:

Posting Komentar