LAB6 F11 - 2 + 1 = 2 + Add(1) Add(1) = 1 STOP HERE...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Recap – Decision Structures (Ch. 7) Concept of Looping (Ch. 8, pp. 179 – 180) Recursive functions (Ch. 8, pp. 189 – 192) Types of Looping Statements (Ch. 8, pp. 201 – 207) Simple For – Next Loops (Ch. 8, pp. 180 – 188)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Used when a set of codes have to repeated multiple times. Eg.: Enter 5 inputs. Input # i Next i Yes No
Background image of page 2
Function that calls itself Be cautious when using recursive functions; as, like the variant data type they too can lead to problems ( infinite looping ) The key while programming recursive functions is to use Decision Structures to stop the infinite loop
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Ex. Program (Function named: Add) to calculate 1 + 2 + 3 +….+ N If N = 3 then Add(3) = 3 + 2 + 1 Add(3) = 3 + Add(2) Add(2) =
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 2 + 1 = 2 + Add(1) Add(1) = 1 STOP HERE (Decision) For Next we will focus on this one Do Loop (Conventional) While - Wend Do Loop While or Do While Loop Do Loop Until or Do Until - Loop For Each All looping structures work on the same concept as described earlier. However, each type of loop has a different syntax. Syntax (Simple For Loop) : For Counter = Min# To Max# Step # Procedure(s) Next Counter Can have any number of lines inside the For loop 1. Set Counter = Min# 2. Execute Procedure (once) 3. Increment Counter (New_Counter = Old_Counter + Step#) 4. Check If Counter is in Range YES Repeat from Step 2 NO Step/End Loop...
View Full Document

Page1 / 7

LAB6 F11 - 2 + 1 = 2 + Add(1) Add(1) = 1 STOP HERE...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online