Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1. Write the syntax of the following loops:
- a. While Loop
- ==========
- While i < 100
- Console.WriteLine(i)
- i += 10
- End While
- ==========
- b. Do Loop ( all 4)
- ========== DO LOOP WHILE
- Do // DO LOOP WHILE executes the code first before checking the condition and stops
- [ statements ] // if it's satisfied.
- Loop While [condition] // Minimum # of executions (if condition is not satisfied): 1
- ==========
- ========== DO LOOP UNTIL
- Do // DO LOOP UNTIL executes the code first before checking the condition and stops
- [ statements ] // if it's satisfied.
- Loop Until [condition] // Minimum # of executions (if condition is not satisfied): 1
- ==========
- ========== DO WHILE LOOP
- Do While [condition] // DO UNTIL LOOP checks the condition first then executes the code and stops if it's
- [ statements ] // satisfied.
- Loop // Minimum # of executions (if condition is not satisfied): 0
- ==========
- ========== DO UNTIL LOOP
- Do Until [condition] // DO UNTIL LOOP checks the condition first then executes the code and stops if it's
- [ statements ] // satisfied.
- Loop // Minimum # of executions (if condition is not satisfied): 0
- ==========
- c. For Loop
- ==========
- For value As Integer = 0 To 5 // FOR Loop will continue to automatically increment "value" and stops once reaches 5
- [statements]
- Next
- ==========
- 2. When will each loop statement execute (before or after the
- condition is tested)?
- a. While Loop
- > after the condition is tested.
- b. Do While Loop
- > after the condition is tested.
- c. Do Loop While
- > before the condition is tested.
- d. Do Until Loop
- > after the condition is tested.
- e. Do Loop Until
- > before the condition is tested
- f. For Loop
- > after the condition is tested.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement