EasyManuals Logo
Home>IBM>Laptop>5100

IBM 5100 Basic Reference Manual

IBM 5100
187 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #82 background imageLoading...
Page #82 background image
IF
78
{
arlth-ex
p
rel-opr arith-exp
}[{&},rith-ex
p
rel-opr arith-exp
l..l
{THEN
}Iine-num
char-exp rel-opr char-exp I r=har-ex
p
rel-opr char-exp
fJ
GOTO
IF
The I F statement allows you
to
transfer program control according
to
the
result
of
an evaluated expression. The syntax
of
the
IF
statement
is
as shown:
IF
{
arith-ex
p
rel-opr arith-exp
}[{&},rith-ex
p
rel-opr arith-exp
11
{THEN
}Iine-num
char-exp rel-opr char-exp I r=har-ex
p
rel-opr char-exp
fJ
GOTO
where:
arith-exp and char-exp are arithmetic or character expressions
or
a string function.
Only one pair
of
expressions
is
required.
rel-opr
is
a relational operator. Only one operator
is
required.
&
is
the symbol entered for AND. I
is
the
symbol entered for OR.
THEN and GOTO specify
that
control should
be
transferred.
If
you enter THEN,
each time the program
is
listed on the display screen
or
printer, the system sub-
stitutes GOTO for THEN.
line-num
is
the number
of
the
statement
to
which control
is
transferred if the
relational expression(s)
is
true.
When an I F statement
is
executed, the expressions are compared
as
specified by
the relational operator.
If
the
relationship
is
true, control
is
transferred
to
the
specified statement number.
If
the
relationship
is
not
true, control
is
passed
to
the
first executable statement following the I F statement.
Before being compared, a character constant containing
less
than 18 characters
is
padded on the right with blanks
to
a length
of
18. A character constant containing
more than 18 characters
is
truncated on the right
to
a length
of
18
before com-
parison. A character constant containing no characters (null)
is
compared as 18
blank characters.
If
&
is
specified, both relational expressions must
be
true before control passes
to
the statement number.
If
I
is
specified, control passes
to
the
specified line number
if either relational expression
is
true.
If
the specified relationship
is
true and
the
specified statement
is
nonexecutable,
control
is
passed
to
the first executable statement following
the
specified nonexe-
cutable statement.
/
/
I

Table of Contents

Other manuals for IBM 5100

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the IBM 5100 and is the answer not in the manual?

IBM 5100 Specifications

General IconGeneral
BrandIBM
Model5100
CategoryLaptop
LanguageEnglish

Related product manuals