1 / 27

Tutorial 4 Decision Making with Control Structures and Statements Section B - Repetition

JavaScript Tutorial 4 - Decision Making with Control Structures and Statements . 2. Tutorial 4B Topics. Section B - Repetitionwhile statementsdowhile statementsfor statementsforin statementswith statementscontinue statements. JavaScript Tutorial 4 - Decision Making with C

abram
Download Presentation

Tutorial 4 Decision Making with Control Structures and Statements Section B - Repetition

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. JavaScript Tutorial 4 - Decision Making with Control Structures and Statements 1 Tutorial 4 Decision Making with Control Structures and Statements Section B - Repetition

    2. JavaScript Tutorial 4 - Decision Making with Control Structures and Statements 2 Tutorial 4B Topics Section B - Repetition while statements do…while statements for statements for…in statements with statements continue statements

    3. JavaScript Tutorial 4 - Decision Making with Control Structures and Statements 3 Repetition Repetition The if, if…else and switch statements select only a single branch of code to execute, then continue to the statement that follows Loop statements Repeatedly execute a statement or a series of statements while a specific is true or until a specific condition becomes true

    4. JavaScript Tutorial 4 - Decision Making with Control Structures and Statements 4 Repetition while Statements Used for repeating a statement or a series of statements as long as a given conditional expression evaluates to true Typically uses a counter to keep track of iteration Syntax while (conditional_expression) { statement(s); }

    5. JavaScript Tutorial 4 - Decision Making with Control Structures and Statements 5 Repetition while Statements Example: var count = 1; while (count <= 5) { document.writeln(count); ++count; } document.writeln(“You have printed 5 numbers.”);

    6. JavaScript Tutorial 4 - Decision Making with Control Structures and Statements 6

More Related