beautypg.com

ProSoft Technology MVI56-BAS User Manual

Page 212

background image

BASIC-52 Implementation

MVI56-BAS ♦ ControlLogix Platform

User Manual

BASIC Module (DB/BAS Compatible)

Page 212 of 234

ProSoft Technology, Inc.

December 13, 2011

10.2.7 GOSUB

Use the GOSUB statement to transfer the module control to a specific

subroutine. This statement allows the program to be divided in different areas.

Syntax:

GOSUB [line number]
10 PRINT "ENTER A NUMBER"
20 INPUT A
30 IF A=1 GOSUB 50 ELSE GOSUB 100
50 PRINT "THIS IS ONE ROUTINE"
60 RETURN
100 PRINT "THIS IS ANOTHER ROUTINE"
110 RETURN