
' ---------------------------------------------------------------
'  Limit Example
'  The V1 value is limited in the range 0 to 100
'  A sound is emitted when limits are reached
' ---------------------------------------------------------------

Key Up   Gosub Increase
Key Down Gosub Decrease

Label Stop
Stop

Label Increase
	v1 = Limit(v1 + 1, 0, 100)
	If LimitReached
		Beep
		Wait seconds 0.5
	EndIf
	Button 2 Text "Value = " + v1
Return

Label Decrease
	v1 = Limit(v1 - 1, 0, 100)
	If LimitReached
		Beep
		Wait seconds 0.5
	EndIf
	Button 2 Text "Value = " + v1
Return


'EXEC Gosub 3
