Difference between revisions of "If"
Jump to navigation
Jump to search
→Spaces: Revised
imported>Daveh (→Notes) |
imported>JOG (→Spaces: Revised) |
||
Line 143: | Line 143: | ||
After the condition or the "else" statement the rest of the line is ignored. There aren't any error messages to warn you, so (since the line appears to be correct) you might spend a lot of time locating the source of the problem. | After the condition or the "else" statement the rest of the line is ignored. There aren't any error messages to warn you, so (since the line appears to be correct) you might spend a lot of time locating the source of the problem. | ||
=== Spaces === | === Spaces and Tabs=== | ||
When using a tabs or space to separate operators/expressions you need to use the same separator on each side if you use space on one side and tab on the other the script might be permanently stopped when the line is executed. | |||
if (SomeVar>=1) ; | if SomeVar>=1 ;GOOD | ||
if ( SomeVar >= 1 ) ;GOOD | if (SomeVar>=1) ;GOOD | ||
if ( SomeVar >= 1 ) ;GOOD | |||
if ( | if (SomeVar___>=___1) ;GOOD ( "___" = Tab) | ||
if___(SomeVar >= 1) ;GOOD ( Tab before "'''('''" and ''nothing'' after it is okay) | |||
Note that you will not receive any compiler error or warnings | if ( SomeVar___>=___1);BAD ( Space and Tab around "'''SomeVar'''" causes problems) | ||
if___SomeVar >= 1 ;BAD ( Tab and Space around "'''SomeVar'''") | |||
if (___SomeVar >= 1) ;BAD ( Space and Tab around "'''('''") | |||
if___( SomeVar >= 1) ;BAD ( Tab and Space around "'''('''") | |||
if SomeVar >=___1 ;BAD ( Space and Tab around "'''=>'''") | |||
if (SomeVar___>= 1) ;BAD ( Tab and Space around "'''=>'''") | |||
Note that you will not receive any compiler error or warnings. You only notice the script not working correctly. You can determine the problem is caused by this by examining the script in an external text-editor or by looking directly at the compiled script data. | |||
[[Category:Commands]] | [[Category:Commands]] |