EasyManuals Logo

Mitsubishi MELFA CR1D User Manual

Mitsubishi MELFA CR1D
458 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 #267 background imageLoading...
Page #267 background image
4MELFA-BASIC IV
Detailed explanation of command words 4-254
While-WEnd (While End)
[Function]
The program between the While statement and WEnd statement is repeated until the loop conditions are
satisfied.
[Format]
[Terminology]
<Loop Condition> Describe a numeric operation expression. (Refer to the syntax diagram)
[Reference Program]
Repeat the process while the numeric variable M1 value is between -5 and +5, and transfer control to step
after WEnd statement if range is exceeded.
1 While (M1>=-5) AND (M1<=5) ' Repeat the process while the value of numeric variable M1 is
between -5 and +5.
2 M1=-(M1+1) ' Add 1 to M1, and reverse the sign.
3 Print# 1, M1 ' Output the M1 value.
4 WEnd ' Return to the While statement (step 1)
5 End ' End the program.
[Explanation]
(1) The program between the While statement and WEnd statement is repeated.
(2) If the result of <Expression> is true (not 0), the control moves to the step following the While statement
and the process is repeated.
(3) If the result of <Expression> is false (is 0), then the control moves to the step following the WEnd state-
ment.
(4) If a GoTo instruction forces the program to jump out from between a While statement and a WEnd state-
ment, the free memory available for control structure (stack memory) decreases. Thus, if a program is
executed continuously, an error will eventually occur. Write a program in such a way that the loop exits
when the condition of the While statement is met.
While[]<Loop Condition>
:
WEnd

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Mitsubishi MELFA CR1D and is the answer not in the manual?

Mitsubishi MELFA CR1D Specifications

General IconGeneral
BrandMitsubishi
ModelMELFA CR1D
CategoryController
LanguageEnglish

Related product manuals