'Function / Sub By Val or By Ref
'Now, the authentic definition is:
'When a parameter is passed by reference, the caller and the callee use the same variable for the parameter. If the callee modifies the parameter variable, the effect is visible to the caller's variable.
'When a parameter is passed by value, the caller and callee have two independent variables with the same value. If the callee modifies the parameter variable, the effect is not visible to the caller.
C1% = 3
PRINT C1%;
"- Numeric Original" PRINT C1%;
"- Numeric After SUB By Value" PRINT Ch%
((C1%
));
"- FUNCTION Result After FUNCTION By Value" PRINT C1%;
"- Numeric After FUNCTION By Value" PRINT Ch%
(C1%
);
"- FUNCTION Result After FUNCTION By Reference" PRINT C1%;
"- Numeric After FUNCTION By Reference" PRINT C1%;
"- Numeric After SUB By Reference"
W2$ = "Change[to[Spaces"
PRINT W2$;
" - String Original" PRINT W2$;
" - String After SUB By Value" PRINT Spaced$
((W2$
));
" - FUNCTION Result After FUNCTION By Value" PRINT W2$;
" - String After FUNCTION By Value" PRINT Spaced$
(W2$
);
" - FUNCTION Result After FUNCTION By Reference" PRINT W2$;
" - String Result After FUNCTION By Reference" PRINT W2$;
" - String Result After SUB By Reference"
C% = C% + 1
Ch% = 2 * C%
Spaced$ = X$
C% = 3 * C%
X$ = X$ + "[zzz"