Information Technology Reference
In-Depth Information
define
line-counter
signed integer
(2)
value
0
loop:
line-counter
=
line-counter
- 2
if
line-counter
> 9
go to
end-program
end-if
go to
loop
end-program:
end
note what will happen now. The field
line-counter
will be 0 to start and then -2, which is what we want, and then -4, -6, -8 and -10. But it
will not stop there as we will be stuck in a loop since
line-counter
is not getting closer to the value 9, it is proceeding in the opposite direction, becoming a
smaller negative number. We could change the lines above by initially setting the value of
line-counter
to 10 and changing the decision line to
if
line-counter
= 0
and now the endless looping will not take place.
Consider the following
define
j
character
(11)
value
“candlelight”
define
k
character
(6)
define
m
character
(5)
k
=
j
(1:6)
m
=
j
(7:5)
If we look at the variables after the assign statements,
k
will be
candle
and
m
will be
light
.
That's because we're getting pieces of a string of characters from one variable. The
expression
j
(1:6)
will result in the characters in the variable
j
starting in position 1 for 6 positions being moved to the variable
k
,
so it becomes the value
candle
. For the variable
m
5 characters starting in position 7 will be moved to
m
,