IBM SC34-5764-01 Manual de usuario Pagina 67

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 481
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 66
Exercise - Using a DO UNTIL Loop
Change the program in the previous exercise on page “Exercise - Using a DO WHILE Loop” on page 43
from a DO WHILE to a DO UNTIL loop and achieve the same results. Remember that DO WHILE loops
check for true expressions and DO UNTIL loops check for false expressions, which means their logical
operators are often reversed.
/******************************** REXX ******************************/
/* This program uses a DO UNTIL loop to ask for a password. If the */
/* password is incorrect three times, the loop ends. */
/********************************************************************/
password = 'abracadabra'
time = 0
DO UNTIL (answer = password) | (time = 3)
PULL answer /* Gets ANSWER from input stream */
time = time + 1
END
Figure 24. Example Using DO UNTIL
Control Flow within a Program
Chapter 4. Controlling the Flow within a program 45
Vista de pagina 66
1 2 ... 62 63 64 65 66 67 68 69 70 71 72 ... 480 481

Comentarios a estos manuales

Sin comentarios