Visual Logic

Post on 24-Feb-2016

63 views 0 download

Tags:

description

Visual Logic. Chapter 4. For Loops. Used to automate the initialize , test , and update process. . Count a to b by c . Count a to b. a: Initialize b: Test Step = 1. a: Initialize b: Test c: Step. Step Value in For Loops. For Loop with Negative Step Value Example. - PowerPoint PPT Presentation

transcript

VISUAL LOGICChapter 4

Used to automate the initialize, test, and update process.

For Loops

Counta to b by c

Counta to b

a: Initializeb: Testc: Step

a: Initializeb: TestStep = 1

Step Value in For Loops

For Loop with Negative Step Value Example

Comparing While and For Loops

While• Explicit Initialization statement • Explicit Test Condition statement• Explicit Update statement

For• Automatically performs these three actions

Comparison of While and For Loops

Example

Loop contained inside the body of another loop

Nested Loops

Nested loop- Printing the values of outer loop and inner loop counters

Printing “Hello” 16 times- Solution 1

Printing “Hello” 16 times- Solution 2

Multiplication Table Example

Triangle Problem Example

Some Graphics

Drawing a Box

More Box Demo

Fun Box

Twisted Box with Color