Bad IF .. THEN .. ELSE .. ENDIF coding doesn't give an error
Some others may make the same mistakes that I have
Some other languages (VBA, Javascript, PHP) have various IF THEN ELSE syntax.
I have used the wrong syntax before and instead of giving an error, the execution hangs up.
I wonder how hard it would be to check for the following bad syntax?
(Low priority -- I don't mean to be obnoxious)
' for TRUE:
' line TF1 hangs
' line TF2 hangs
' line TF3 OK
' for FALSE:
' line TF1 hangs
' line TF2 hangs
' line TF3 doesn't print "F3"
Uses "console"
Sub TBMain()
Sub1(TRUE) ' or false
PrintL "End"
WaitKey
End Sub
Sub Sub1(condition As Boolean)
If condition Then ' correct syntax
PrintL "--TRUE--"
Else
PrintL "--FALSE--"
End If
If condition Then PrintL "T1" Else PrintL "F1" ' line TF1
If condition Then PrintL "T2" ' line TF2
Else PrintL "F2"
If condition Then: PrintL "T3": Else: PrintL "F3": End If ' line TF3
End Sub