Difference between revisions of "Select a Portion of a Program"
From ArcoWiki
Line 3: | Line 3: | ||
This example shows how to ask an user input and then using the combination of a SELECT structure with JUMPTO commands to reach the part of the program required. | This example shows how to ask an user input and then using the combination of a SELECT structure with JUMPTO commands to reach the part of the program required. | ||
− | <code>(ASK_AGAIN) | + | <code>(ASK_AGAIN)</code> |
− | <code>TEXT/QUERY,(AN_QUERY),40,N,L,'DO YOU WANT TO [[Jump|JUMP]] | + | <code>TEXT/QUERY,(AN_QUERY),40,N,L,'DO YOU WANT TO [[Jump|JUMP]] SOMEWHERE? (PRESS 0 FOR NO, 1 FOR YES)'</code> |
− | <code>SELECT/AN_QUERY | + | <code>SELECT/AN_QUERY</code> |
− | <code>CASE/0 | + | <code>CASE/0</code> |
− | ::<code>JUMPTO/(SELECTED_NO) | + | ::<code>JUMPTO/(SELECTED_NO)</code> |
− | <code>ENDCAS | + | <code>ENDCAS</code> |
− | <code>CASE/1 | + | <code>CASE/1</code> |
− | ::<code>JUMPTO/(SELECTED_YES) | + | ::<code>JUMPTO/(SELECTED_YES)</code> |
− | <code>ENDCAS | + | <code>ENDCAS</code> |
− | <code>DFTCAS | + | <code>DFTCAS</code> |
− | ::<code>JUMPTO/(ASK_AGAIN) | + | ::<code>JUMPTO/(ASK_AGAIN)</code> |
− | <code>ENDCAS | + | <code>ENDCAS</code> |
− | <code>ENDSEL | + | <code>ENDSEL</code> |
− | <code>(SELECTED_NO) | + | <code>(SELECTED_NO)</code> |
::<code>TEXT/OPER,'YOU SELECTED NO' | ::<code>TEXT/OPER,'YOU SELECTED NO' | ||
− | ::<code>JUMPTO/(END_PROGRAM) | + | ::<code>JUMPTO/(END_PROGRAM)</code> |
− | <code>(SELECTED_YES) | + | <code>(SELECTED_YES)</code> |
− | ::<code>TEXT/OPER,'YOU SELECTED YES' | + | ::<code>TEXT/OPER,'YOU SELECTED YES'</code> |
− | + | <code>(END_PROGRAM)</code> | |
− | (END_PROGRAM) |
Revision as of 13:35, 15 May 2017
During the creation of a DMIS program, it might be necessary to ask the user to make a choice and then the program will execute accordingly.
In order to do so the commands SELECT and JUMPTO are useful tools.
This example shows how to ask an user input and then using the combination of a SELECT structure with JUMPTO commands to reach the part of the program required.
(ASK_AGAIN)
TEXT/QUERY,(AN_QUERY),40,N,L,'DO YOU WANT TO JUMP SOMEWHERE? (PRESS 0 FOR NO, 1 FOR YES)'
SELECT/AN_QUERY
CASE/0
JUMPTO/(SELECTED_NO)
ENDCAS
CASE/1
JUMPTO/(SELECTED_YES)
ENDCAS
DFTCAS
JUMPTO/(ASK_AGAIN)
ENDCAS
ENDSEL
(SELECTED_NO)
TEXT/OPER,'YOU SELECTED NO'
<code>JUMPTO/(END_PROGRAM)
(SELECTED_YES)
TEXT/OPER,'YOU SELECTED YES'
(END_PROGRAM)