File: callsub.bas

package info (click to toggle)
bwbasic 2.20pl2-8
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,204 kB
  • ctags: 1,248
  • sloc: ansic: 21,002; makefile: 116
file content (32 lines) | stat: -rw-r--r-- 889 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

rem ----------------------------------------------------
rem CallSub.BAS
rem ----------------------------------------------------

Print "CallSub.BAS -- Test BASIC Call and Sub Statements"
Print "The next printed line should be from the Subroutine."
Print
testvar = 17

Call TestSub 5, "Hello", testvar

Print
Print "This is back at the main program. "
Print "The value of variable <testvar> is now "; testvar

Print "Did it work?"
End

rem ----------------------------------------------------
rem Subroutine TestSub
rem ----------------------------------------------------

Sub TestSub( xarg, yarg$, tvar )
   Print "This is written from the Subroutine."
   Print "The value of variable <xarg> is"; xarg
   Print "The value of variable <yarg$> is "; yarg$
   Print "The value of variable <tvar> is "; tvar
   tvar = 99
   Print "The value of variable <tvar> is reset to "; tvar
End Sub