Table Of Contents | Index |
As programs get more complex, it gets harder to match the IFs with the ELSEs and the ENDIFs. This is where indenting comes in. It creates a logical grouping of statements and you can easily see what goes with what.
Procedure IfDemo IF <condition> <statement> <statement> ELSEIF <condition> <statement> ELSEIF <condition> <statement> <statement> ELSE <statement> <statement> WHILE <condition> <statement> <statement> ENDWHILE <statement> ENDIF <statement> EndProcYou can easily see how this helps you follow what you are writing. Now here's a new trick. If you are using an IF, and plan to use an ELSE and an ENDIF, on the line under the IF statement, type in your ELSE and ENDIF lines. Then go back and insert your statements in between these lines. This will help you avoid forgetting the ENDIF or getting mixed up as to which IF matches which ELSE.
A similar trick can be done with parens and brackets. When typing a left paren, type the matching right paren with it. Then fill in the code you want to put inside the parens or brackets.
Table Of Contents | Index |
|