IBM SC34-5764-01 Manuel d'utilisateur Page 57

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 481
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 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
Vue de la page 56
1 2 ... 52 53 54 55 56 57 58 59 60 61 62 ... 480 481

Commentaires sur ces manuels

Pas de commentaire