Remote-processing CAMBASIC Manual do Utilizador Página 86

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 208
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 85
Commands - 53
GOSUB
Statement
SYNTAX: GOS UB line/label
.
.
.
RETURN
PURPOSE: To branch to and return from a subroutine.
REMARK S: line/label is the beginning of the subroutine.
A subroutine may be called any number of times in a program, and a subroutine may be called from
within another subroutine.
The RETUR N statement causes CAM BASIC to branch back to the statement follow ing the most
recent G OSUB statement. A subroutine may contain m ore than one RET URN statement, should
logic dictate a return at different points in the subroutine. Subroutines may appear anywhere in the
program.
To prevent inadvertent entry into the subroutine, you may put an EN D or GO TO statement in front
of it to direct program control around the subroutine.
NOTE: The execution of the G OSUB statement is independent of the location of the target line in
the program. No run– time search occurs.
When a label is used with GOSUB, a statement cannot follow GOSUB on the same line.
EXAMPLE: 10 GOSUB 40
20 PRINT "Back from subroutine"
30 END
40 PRINT "subroutine";
50 PRINT "in";
60 PRINT "progress"
70 RETURN
RUN
subroutine in progress
Back from subroutine
Vista de página 85
1 2 ... 81 82 83 84 85 86 87 88 89 90 91 ... 207 208

Comentários a estes Manuais

Sem comentários