IBM SC34-5764-01 Manuale Utente Pagina 57

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 481
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 56
Looking at the program you might assume the ELSE belongs to the first IF. However, the language
processor associates an ELSE with the nearest unpaired IF. The outcome is as follows:
What a lovely day!
We should take our raincoats!
/******************************** REXX *******************************/
/* This program demonstrates what can happen when you do not include */
/* DOs, ENDs, and ELSEs in nested IF...THEN...ELSE instructions. */
/*********************************************************************/
weather = 'fine'
tenniscourt = 'occupied'
IF weather = 'fine' THEN
SAY 'What a lovely day!'
IF tenniscourt = 'free' THEN
SAY 'Let''s play tennis!'
ELSE
SAY 'We should take our raincoats!'
Figure 17. Example of Missing Instructions
Control Flow within a Program
Chapter 4. Controlling the Flow within a program 35
Vedere la pagina 56
1 2 ... 52 53 54 55 56 57 58 59 60 61 62 ... 480 481

Commenti su questo manuale

Nessun commento