QBASIC Functions and Statements
Loop is a statement which executes one or more lines of code in certain number of times. Similarly, An array is a special type of variable with an unique name, size and type. This note provides an information about Qbasic Functions and statements.
Summary
Loop is a statement which executes one or more lines of code in certain number of times. Similarly, An array is a special type of variable with an unique name, size and type. This note provides an information about Qbasic Functions and statements.
Things to Remember
- Loop is a statement which executes one or more lines of code in certain number of times.
- An array is a special type of variable with an unique name, size and type. In another words, an array is a data structure that stores multiple values of similar type with a common name bu having different subscript.
- The Branching Statement
- The branching statement is decision making statement, depending upon the decision it can change the order of execution.
- Numeric functions are the type of library function which are used to process numeric or string data and always returns numeric value.
MCQs
No MCQs found.
Subjective Questions
No subjective questions found.
Videos
No videos found.

QBASIC Functions and Statements
Loop
Loop is a statement which executes one or more lines of code in certain number of times. The loop ends with the false condition. Every loop statement requires the following terms:
- Counter:It is a variable which controls the loop statement and provides the track to run the loop statement in certain number of times.
- Initial Value:The string value of loop statement is known as initial value.
- Sentient Value:This is the final value of loop statement.
- Step value:It is used to modify the value of counter by certain amount.
If...GOTO LOOP
This program use IF----GOTO to create a loop.
x= 10
start:
Print x
x= x+1 ( This adds 1 to x)
If x < 15 Then GOTO start
Output
10
11
12
13
14
For.....NEXT
It is the count controlled loop which knows how many times the loop is to be executed. The loop is executed with the loop control variable at initial value to final value and values in between.
WHILE....WEND
It is a loop statement that executes a series of statements in a loop as long as the given statement is true.
ARRAY
An array is a special type of variable with an unique name, size and type. In another words, an array is a data structure that stores multiple values of similar type with a common name bu having different subscript. An array is defined by using DIM statement. There are two types of array:
- Single Dimensional Array: An array having series of similar type of data represented by a variable with a single subscript or index value known as single dimensional array. Example: DIM NUM (6), It defines a single dimensional array having named NUM having six sub-scripted variables.
- Multidimensional Array: An array having series of similar type of data represented by a variable with double subscripts is known as multidimensional array.
DIM
Syntax: DIM [ array name] [ value ]
Example:DIM kul (5)
The Branching Statement
The branching statement is decision making statement, depending upon the decision it can change the order of execution.
IF......THEN Statement
It helps the computer to check whether the relation is TRUE or FALSE.
Syntax: Line Number IF ( relational expression) THEN n where n is a line number or an instruction. If the expression is true then n will be executed otherwise statement following IF..THEN statement will be executed.
IF....THEN....ELSE
It is a decision making statement as it decides the path of the program.
Syntax: If (Condition) ...THEN (Line number or instruction) .....ELSE (Line number or instruction)
IF_ _ _ _ _ ELSEIF Statement
Syntax: IF ( Condition ) THENStatement-1ELSEIF (Condition) THENStatement-2ELSEIF (Conditon) THENStatement-ELSEStatement-4ENDIF
SELECT-CASE Statement
Syntax: SELECT CASE ( expression )
Statement-1
Case ( expression )
Statement-2
Case ( expression )
Statement-3
Case ELSE
Statement-4
END SELECT
Numeric Functions
Numeric functions are the type of library function which are used to process numeric or string data and always returns numeric value.
Some numeric functions are as follows:
- LEN FUNCTION: It is string processing function that return the number of characters in a string and it also returns the number of bytes required by a variable.
- ASC FUNCTION: It returns the ASCII (AMERICAN STANDARD CODE FOR INFORMATION INTERCHANGE) code of the first character of a string expression.
- VAL FUNCTION: It converts a string expression consisting of numeric digits into number and returns the number a value.
- ABS FUNCTION: It returns the absolute value of numeric expression or converts a negative number to a positive number.
- INT FUNCTION: It rounds and returns the largest integer less than or equal to a numeric expression.
- FIX FUNCTION: It returns the integer part of numeric expression.
- CINT FUNCTION: It converts a numeric expression to an integer by rounding the fractional part of the expression.
- SGN FUNCTION: It returns the sign of the number.
- SQR FUNCTION: It returns the square root of any positive number.
- SIN FUNCTION: It returns the sine of a specified angle.
- COS FUNCTION: It returns the cosine of a specified angle.
- TAN FUNCTION: It returns the tangent of a specified angle.
Lesson
Modular Programming in QBASIC
Subject
Computer Science
Grade
Grade 10
Recent Notes
No recent notes.
Related Notes
No related notes.