Difference between revisions of "Select a Portion of a Program"
From ArcoWiki
(4 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
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.<br /> | 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.<br /> | ||
− | In order to do so the commands SELECT and JUMPTO are useful tools.<br /> | + | In order to do so the commands [[Select Case|SELECT CASE]] and [[JumpTo|JUMPTO]] are useful tools.<br /> |
− | 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 Case|SELECT CASE]] structure with [[JumpTo|JUMPTO]] commands to reach the part of the program required.<br /> |
+ | <br /> | ||
+ | <br /> | ||
+ | <code>(ASK_AGAIN)</code><br /> | ||
+ | <code>TEXT/QUERY,(AN_QUERY),40,N,L,'DO YOU WANT TO [[Jump|JUMP]] SOMEWHERE? (PRESS 0 FOR NO, 1 FOR YES)'</code><br /> | ||
+ | <code>SELECT/AN_QUERY</code><br /> | ||
+ | <code>CASE/0</code><br /> | ||
+ | ::<code>JUMPTO/(SELECTED_NO)</code><br /> | ||
+ | <code>ENDCAS</code><br /> | ||
+ | <code>CASE/1</code><br /> | ||
+ | ::<code>JUMPTO/(SELECTED_YES)</code><br /> | ||
+ | <code>ENDCAS</code><br /> | ||
+ | <code>DFTCAS</code><br /> | ||
+ | ::<code>JUMPTO/(ASK_AGAIN)</code><br /> | ||
+ | <code>ENDCAS</code><br /> | ||
+ | <code>ENDSEL</code><br /> | ||
− | <code>( | + | <code>(SELECTED_NO)</code><br /> |
− | <code>TEXT/ | + | ::<code>TEXT/OPER,'YOU SELECTED NO'</code><br /> |
− | < | + | ::<code>JUMPTO/(END_PROGRAM)</code><br /> |
− | |||
− | ::<code>JUMPTO/( | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | <code>( | + | <code>(SELECTED_YES)</code><br /> |
− | ::<code>TEXT/OPER,'YOU SELECTED | + | ::<code>TEXT/OPER,'YOU SELECTED YES'</code><br /> |
− | + | <code>(END_PROGRAM)</code><br /> | |
− | + | ||
− | :: | + | [[it:Seleziona una parte di un programma]] |
− | + | [[zh-cn:选择一个程序的一部分]] | |
+ | [[pt:Selecione uma parte de um programa]] | ||
+ | [[de:Wählen Sie einen Teil eines Programms]] | ||
+ | [[es:Seleccione una porción de un programa]] | ||
+ | [[en:Select a Portion of a Program]] | ||
+ | |||
+ | [[Category:Dmis_Tutorial]] |
Latest revision as of 09:46, 15 June 2018
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 CASE and JUMPTO are useful tools.
This example shows how to ask an user input and then using the combination of a SELECT CASE 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'
JUMPTO/(END_PROGRAM)
(SELECTED_YES)
TEXT/OPER,'YOU SELECTED YES'
(END_PROGRAM)