Jump to navigation Jump to search
Revision as of 03:28, 15 September 2010 by (Created page with ''''IF''' statements make Boolean True or False program evaluations to automate program decision making. <center>''Syntax:'' IF evaluation is true THEN execute code</center> *…')
IF statements make Boolean True or False program evaluations to automate program decision making.
- The evaluation by IF must be true for the THEN code to be run.
- IF statements can also have alternative evaluations using ELSEIF and ELSE conditions.
- When the IF statement and/or code to be run is more than code line, an END IF statement MUST be used.
- With multiple code lines to run, end the IF statement with THEN and place all of the code on lines below that line.
- With multiple code lines to run (a IF...END IF block), the IF statement and END IF statement must be the first statement on the line!
- Qbasic's IDE may return an error pointing somewhere else if you forget to use END IF!
- Use colons to change multiple values in a one line IF statement. You cannot use AND on the other side of THEN!
See also: IF...THEN