The LET statement assigns the value of an expression to a variable.
Syntax
LN [LET] Variable = expression
Where,
LN : Line Number
[LET] : LET is optional (i.e. the equal sign(=) is sufficient to assign an expression to a variable.
Variable : Stores the values of expression on the right hand side.
Expression valid BASIC expression
Points to remember
1. 30 LET X = 20
2. 20 LET N $ = "SUMA SHAH"
Syntax
LN [LET] Variable = expression
Where,
LN : Line Number
[LET] : LET is optional (i.e. the equal sign(=) is sufficient to assign an expression to a variable.
Variable : Stores the values of expression on the right hand side.
Expression valid BASIC expression
Points to remember
- In the LET statement the type of variable and type of expression must match each other.
- The LET statement is optional in programs, only the equal sign(=) is sufficient to assign an expression to a variable.
1. 30 LET X = 20
2. 20 LET N $ = "SUMA SHAH"
CS 5.5 Dislplay on the screen for LET statement
Ok
LIST
10 REM Learning the use of LET statement
20 LET N$ = "SUM SHAH"
30 LET C = 9
40 LET A$ = EAST - POLE HIGH SCHOOL"
50 LET R = 26
60 PRINT " MY NAME IS " ; N$
70 PRINT " I STUDY IN CLASS ";C
80 PRINT " MY SCHOOL'S NAME IS ";A$
90 PRINT " MY ROLL NO. IS "; R
100 END
Ok
RUN
MY NAME IS SUMA SHAH
I STUDY IN CLASS 9
MYS SCHOOL NAME IS EAST - POLE HIGH SCHOOL
MY ROLL NO IS 26
Ok
CS 5.6 Display on the screen for LET statement
Ok
LIST
10 REM Learning the use of LET statement
20 REM Values of two numbers X and Y
30 LET X=20
40 LET Y=10
50 REM Addition of two numbers X and Y
60 LET A =X+Y
70 PRINT "VALUE OF X =";X
80 PRINT "VALUE OF Y=";Y
90 PRINT "ADDITION OF X AND Y =";A
100 END
Ok
RUN
VALUE OF X= 20
VALUE OF Y=10
ADDITION OF X AND Y = 30
Ok
No comments:
Post a Comment