BCX Console Demonstration Program s22.bas |
DIM A! ' global DIM B! ' global DIM C! ' global C! = 100.123 '<<< This value should not change! B! = 123 '<<< This value should not change! A! = Fun!(B!, C!) '<<< C allows type translation automatically! PRINT "The value of A! = ", A! PRINT "The value of B! should still be <123> ...", B! FUNCTION Fun! (Y, Z) DIM A$ DIM B! A$ = "Hello from inside our function!" ' a local string variable PRINT A$ 'The B! variable below is the local 'The C! variable is the global variable 'The Z variable is the function parameter Variable B! = 3 * Z + C! + Y FUNCTION = B! END FUNCTION
Result:
Hello from inside our function! The value of A! = 523.123 The value of B! should still be <123> ... 123