Page 58 - 1
P. 58
QBASIC Statements
Let’s first learn about QBASIC statements.
LET Statement
LET statement is used to assign a value or data to a variable stated in QBASIC.
Syntax
LET <Variable name> = <Value of expression>
Example
LET A = 6
A will be assigned with the value 6.
PRINT Statement
PRINT statement is used to display the numbers, values or messages on the output screen.
We can display more than one output by using a semi colon.
Syntax
PRINT <Constant> or <Variable> or <Expression>
Example 1
PRINT “HELLO WORLD”
HELLO WORLD will be displayed on the output screen.
Example 2
LET A = Hello
LET B = My
LET C = World
PRINT A; “ ” B; “ ” C
Hello My World will be displayed on the output screen.
If you need to display the output with a plenty of space, you can
use a comma in place of the semi colon.
Example 3
LET A = Hello
LET B = My
LET C = World
PRINT A, “ ” B, “ ” C
Hello My World will be displayed on the output screen with a
lot of space between all the words.
INPUT Statement
INPUT statement is used to take value from the user. Then the value will be stored in the
variable.
Syntax
INPUT <Numeric or String Variable Name>
Example
INPUT A
58