0% found this document useful (0 votes)
34 views

Qb64 Programming Statements II

ICT

Uploaded by

Mariem Khlifi
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Qb64 Programming Statements II

ICT

Uploaded by

Mariem Khlifi
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

QB64

PROGRAMMING
STATEMENTS II
YEAR 7
MARIEM KHLIFI

QB64 PROGRAMMING STATEMENTS II 1


LEARNING OUTCOMES
You will learn about:
• For .... Next
• Do while ..... Loop
• Do until ..... Loop
• While ...... Wend

B64 PROGRAMMING STATEMENTS II


keywords
• QB64
• For .... Next
• Do while
• Do until
• While
2
INTRODUCTION
• Sometimes there is a need to repeat a set of statements more than
once based on a certain condition. This process of repetition is called
Loop or Iteration in programming.
• A loop is used to repeat a block of statements a specific number of

B64 PROGRAMMING STATEMENTS II


times

3
LOOPs
The following loops are available in QB64:

DO WHILE ....
FOR .....NEXT

B64 PROGRAMMING STATEMENTS II


LOOP

DO UNTIL ....
LOOP WHILE .... WEND

4
FOR... NEXT
• The FOR ....NEXT structure is used when you want to perform a
specific number of times.
• It uses a counter variable which is incremented or decremented with
each repetition of the loop

B64 PROGRAMMING STATEMENTS II


• Syntax

5
Program1: to print multiples of
5 from 0 to 30
Open QB64 software and write the following program

B64 PROGRAMMING STATEMENTS II


6
DO WHILE ... LOOP
A DO WHILE... LOOP is performed as long as the condition being tested
is true.
it means that the statements written within the DO.... LOOP will be
repeated until the condition is true.

B64 PROGRAMMING STATEMENTS II


SYNTAX

7
Program2: to print numbers 1 to 10

B64 PROGRAMMING STATEMENTS II


8
DO UNTIL....LOOP
• The DO UNTIL ..... LOOP is very similar to the DO WHILE .... LOOP.
• The only difference is that the DO UNTIL loop is executed ‘until’ a
certain condition is reached rather than ‘while’ a certain condition is
met

B64 PROGRAMMING STATEMENTS II


• It executes the statement if the condition is false and it exits the loop
if the condition is true.
• SYNTAX

9
Program3: to print numbers 1 to 9

B64 PROGRAMMING STATEMENTS II


10
WHILE....WEND
• The WHILE ..... WEND works just like any other loop. It executes a
series of statements as long as a specified condition is true
• Syntax

B64 PROGRAMMING STATEMENTS II


11
Program4: to generate multiples of
5 from 5 to 50

B64 PROGRAMMING STATEMENTS II


12
Activity

13

B64 PROGRAMMING STATEMENTS II


14

B64 PROGRAMMING STATEMENTS II


15

B64 PROGRAMMING STATEMENTS II


16

B64 PROGRAMMING STATEMENTS II


17

B64 PROGRAMMING STATEMENTS II


18

B64 PROGRAMMING STATEMENTS II


19

B64 PROGRAMMING STATEMENTS II

You might also like