To keep track of IF...ENDIF, or indeed any other block statements which themselves could be nested (such as FOR...NEXT, or WHILE...WEND) it's convenient to indent the code for every block statement. The compiler ignores surplus indents and it makes it more human readable when looking at the code. Example...
Code:
Start:
'
' Set Dual-Colour LED
' -------------------
If PowerOn=1 then
High PowerOnLEDGreen
Low PowerOnLEDRed
If BatteryLow=0 then
High PowerOnLEDRed
Low PowerOnLEDGreen
endif
endif
Gosub ScanKeyboard
Goto DoCleverStuff
This way you can easily track the preceeding IF statement associated with any corresponding ENDIF by just following the indented block.
Why is Yoda wearing rubber gloves whilst doing hand-puppet Rabbit impressions?...
Bookmarks