ENG EK 127 Chapter Notes - Chapter 4-5: Switch Statement

62 views3 pages

Document Summary

The general form of an if statement is: if condition action1 else end action2. Any value that isn"t 1 will be counted as a logical true. Statements can be nested, but it is recommended to use comments if doing so. Elseif condition: allows for quicker nesting of if/else statements. A switch statement is used to test multiple if statements at once. Otherwise statements can also be used at the end of switch statements. Must end with end if the same action is wanted for more than one situation, use { , } Used when a set of actions must be repeated for a known amount of times. General form loop/iterator variable: variable within for statement that iterates for loopvar = range end action. The range is indicated using a colon, such as loopvar= 1:5 or loopvar= 1:2:9 inputs within a for loop will iterate, asking for the input each time.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents