Difference between revisions of "Select a Portion of a Program"

From ArcoWiki
Jump to: navigation, search
(Created page with "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 co...")
 
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.
  
(ASK_AGAIN)
+
<code>(ASK_AGAIN)
TEXT/QUERY,(AN_QUERY),40,N,L,'DO YOU WANT TO [[Jump|JUMP]] SOMEWHERTE? (PRESS 0 FOR NO, 1 FOR YES)'
+
<code>TEXT/QUERY,(AN_QUERY),40,N,L,'DO YOU WANT TO [[Jump|JUMP]] SOMEWHERTE? (PRESS 0 FOR NO, 1 FOR YES)'
SELECT/AN_QUERY
+
<code>SELECT/AN_QUERY
CASE/0
+
<code>CASE/0
  JUMPTO/(SELECTED_NO)
+
::<code>JUMPTO/(SELECTED_NO)
ENDCAS
+
<code>ENDCAS
CASE/1
+
<code>CASE/1
  JUMPTO/(SELECTED_YES)
+
::<code>JUMPTO/(SELECTED_YES)
ENDCAS
+
<code>ENDCAS
DFTCAS
+
<code>DFTCAS
  JUMPTO/(ASK_AGAIN)
+
::<code>JUMPTO/(ASK_AGAIN)
ENDCAS
+
<code>ENDCAS
ENDSEL
+
<code>ENDSEL
  
(SELECTED_NO)
+
<code>(SELECTED_NO)
      TEXT/OPER,'YOU SELECTED NO'
+
::<code>TEXT/OPER,'YOU SELECTED NO'
      JUMPTO/(END_PROGRAM)
+
::<code>JUMPTO/(END_PROGRAM)
  
 
+
<code>(SELECTED_YES)
(SELECTED_YES)
+
::<code>TEXT/OPER,'YOU SELECTED YES'
      TEXT/OPER,'YOU SELECTED YES'
 
  
 
(END_PROGRAM)
 
(END_PROGRAM)

Revision as of 13:32, 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) <code>TEXT/QUERY,(AN_QUERY),40,N,L,'DO YOU WANT TO JUMP SOMEWHERTE? (PRESS 0 FOR NO, 1 FOR YES)' <code>SELECT/AN_QUERY <code>CASE/0

<code>JUMPTO/(SELECTED_NO)

<code>ENDCAS <code>CASE/1

<code>JUMPTO/(SELECTED_YES)

<code>ENDCAS <code>DFTCAS

<code>JUMPTO/(ASK_AGAIN)

<code>ENDCAS <code>ENDSEL

<code>(SELECTED_NO)

<code>TEXT/OPER,'YOU SELECTED NO'
<code>JUMPTO/(END_PROGRAM)

<code>(SELECTED_YES)

<code>TEXT/OPER,'YOU SELECTED YES'

(END_PROGRAM)