Handling Errors

BlitzMax Forums/BlitzMax Programming/Handling Errors

Strict
Graphics 800 , 600

While Not KeyHit(key_escape) 
	For Local i = 10 To 0 Step - 1
		Cls
		Local a:Float
	
		Try
			a = 10/i
		Catch a:Object
			Cls
			DrawText "ERROR: " + a.tostring() , 0 , 0
			DrawText "hit any key to exit...",0,20
			Flip
			WaitKey() 
			End
		EndTry
		
		DrawText "10/"+i+"= " + a , 0 , 0
		Flip
		Delay 200
	Next
Wend