0% found this document useful (0 votes)
15 views3 pages

Control Structures in BASIC

There are 3 types of control structures in BASIC: sequence, selection, and repetition. Sequence structure executes code in the written order without skipping lines. Selection structure executes one block of code and skips the other depending on a condition, using statements like IF-THEN and IF-THEN-ELSE. Repetition structure executes code repeatedly until a condition is met, using loops like FOR-NEXT and WHILE-WEND. Control transfer moves execution to another part of the program, and has two types: unconditional using GOTO, and conditional depending on a condition using statements like ON...GOTO and IF-THEN-ELSE.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

Control Structures in BASIC

There are 3 types of control structures in BASIC: sequence, selection, and repetition. Sequence structure executes code in the written order without skipping lines. Selection structure executes one block of code and skips the other depending on a condition, using statements like IF-THEN and IF-THEN-ELSE. Repetition structure executes code repeatedly until a condition is met, using loops like FOR-NEXT and WHILE-WEND. Control transfer moves execution to another part of the program, and has two types: unconditional using GOTO, and conditional depending on a condition using statements like ON...GOTO and IF-THEN-ELSE.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Chapter # 3Control Structure

Q .Define control structure. How many control structures are available in BASIC.
Discuss briefly.

Control structure
Control structure is used to control the flow of execution of a program.

Control structures in BASIC


There are 3 types of control structure in BASIC.

1)Sequence control structure.

2)Selection control structure.

3)Repetition control structure.

Sequence Control Structure


In this structure, code is executed in the same order in which it is written. No
line is skipped. It is mostly used structure.

Selection Control Structure


In this structure, code is executed depending upon the condition. One block of
code will be executed and other block will be skipped.

Example:

IF-THEN

IF-THEN-ELSE

ONGOTO
Repetition Control Structure
In this structure, code is executed again and again until given condition is true.

Example:

FOR NEXT LOOP

WHILE WEND LOOP

What is control transfer? What are its types?

Control transfer
Control transfer means moving control from one place to another Place in the
program. It has 2 types.

Unconditional
Conditional

Unconditional control transfer


In this transfer, control moves from one point to other specific point by skipping
one or more lines without any condition.

Example:

GOTO Statement

Conditional control transfer


In this transfer, control moves from one point to other specific point by skipping
one or more lines depending on a certain condition.

Example:
ON GOTO Statement

IF-THEN-ELSE Statement

You might also like