Rockwell-automation 1771-DB BASIC MODULE Bedienungsanleitung Seite 186

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 394
  • Inhaltsverzeichnis
  • FEHLERBEHEBUNG
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 185
Chapter
Statements
1
1
11 -34
Use the RETURN statement to return control to the statement following
the most recently executed GOSUB (page 11 -13). Use one return for each
GOSUB to avoid overflowing the control stack. This means that a
subroutine you call with the GOSUB statement can call another subroutine
with another GOSUB statement.
Syntax
RETURN
Example
Simple Subroutine
>1
REM EXAMPLE PROGRAM
>
10 FOR I = 1 TO 5
>
20 GOSUB 100
>
30 NEXT I
>
40 END
>
100 PRINT I
>
110 RETURN
READY
>RUN
1
2
3
4
5
Nested Subroutine
>1
REM EXAMPLE PROGRAM
>
10 FOR I = 1 TO 5
>
20 GOSUB 100
>
30 NEXT I
>
40 END
>
100 PRINT I,
>
110 GOSUB 200
>
120 RETURN
>
200 PRINT I*I,
>
210 GOSUB 300
>
220 RETURN
>
300 PRINT I*I*I
>
310 RETURN
READY
>RUN
1 1 1
2 4 8
3 9 27
4 16 64
5 25 125
RETURN
Seitenansicht 185
1 2 ... 181 182 183 184 185 186 187 188 189 190 191 ... 393 394

Kommentare zu diesen Handbüchern

Keine Kommentare