Page 105 - TechPluse_C6_Flipbook
P. 105
IF Statement
In BASIC-256, the if statement is used for conditional execution of code based on whether a
condition evaluates to true or false.
The syntax of the IF statement is as follows:
if <condition> then
<statements>
end if
For Example:
INPUT "Enter a number: ", num
if num > 0 then
PRINT "The number is positive."
end if
Output:
Enter a number: 5
The number is positive.
Example 2:
INPUT "Enter a number: ", num
if num mod 2 = 0 then
PRINT "The number is even."
else
PRINT "The number is odd."
end if
Output:
Enter a number: 4
The number is even.
Restart
BASIC-256 is a very simple programming language used for calculations and business
applications.
Editor is identified as the area where we write our BASIC-256 programs.
A variable is used to store different kinds of information, such as text or a number, in the
computer’s memory.
The names we give to the variable are called identifiers.
Operators are special symbols in BASIC-256 that carry out arithmetic or logical
computation.
Comments are used to explain the program code.
Introduction to BASIC-256 103

