IBM SC34-5764-01 Bedienungsanleitung Seite 85

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 481
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 84
The following examples show how results differ when a subroutine or function uses or does not use
PROCEDURE.
The next two examples are the same, except they use functions rather than subroutines.
/******************************* REXX ********************************/
/* This program uses a PROCEDURE instruction to protect the */
/* variables within its subroutine. */
/*********************************************************************/
number1 = 10
CALL subroutine
SAY number1 number2 /* Produces 10 NUMBER2 */
EXIT
subroutine: PROCEDURE
number1 = 7
number2 = 5
RETURN
Figure 33. Example of Subroutine Using the PROCEDURE Instruction
/******************************* REXX ********************************/
/* This program does not use a PROCEDURE instruction to protect the */
/* variables within its subroutine. */
/*********************************************************************/
number1 = 10
CALL subroutine
SAY number1 number2 /* Produces 7 5 */
EXIT
subroutine:
number1 = 7
number2 = 5
RETURN
Figure 34. Example of Subroutine without the PROCEDURE Instruction
/******************************* REXX ********************************/
/* This program uses a PROCEDURE instruction to protect the */
/* variables within its function. */
/*********************************************************************/
number1 = 10
SAY pass() number2 /* Produces 7 NUMBER2 */
EXIT
pass: PROCEDURE
number1 = 7
number2 = 5
RETURN number1
Figure 35. Example of Function Using the PROCEDURE Instruction
Writing Subroutines and Functions
Chapter 6. Writing Subroutines and Functions 63
Seitenansicht 84
1 2 ... 80 81 82 83 84 85 86 87 88 89 90 ... 480 481

Kommentare zu diesen Handbüchern

Keine Kommentare