Monday, December 19, 2016

Monkey-X - Beginners - Error - code example

' Error command - Stop the program and give a error message.

Import mojo

Class MyGame Extends App
    Field cnt:Int=0
    Method OnCreate()
    End Method
    Method OnUpdate()
        If cnt>10 Then Error "cnt is bigger then 10"
    End Method
    Method OnRender()
        Cls 0,0,0 
        SetColor 255,255,255
    End Method
End Class

Function Main()
    New MyGame()
End Function

No comments:

Post a Comment