Pass by Value:
Variable v = 4321
String s = "Hello"
Function Subroutine(v, s)
Print v, s
// These lines have NO EFFECT on the calling routine.
v = 1234
s = "Goodbye"
Note that v and s are local variables in Routine. In Subroutine, they are parameters which act very much like local variables. The names "v" and "s" are local to the respective functions. The v in Subroutine is not the same variable as the v in Routine although it initially has the same value.
The last two lines of Subroutine set the value of the local variables v and s. They have no effect on the value of the variables v and s in the calling Routine. What is passed to Subroutine is the numeric value 4321 and the string value "Hello".
String folderstring ="root:abc"
Pass by Reference:
You can specify that a parameter to a function is to be passed by reference rather than by value. In this way, the function called can change the value of the parameter and update it in the calling function. This is much like using pointers to arguments in C. This technique is needed and appropriate only when you need to return more than one value from a function.
The variable or string being passed must be a local variable and can not be a global variable. To designate a variable or string parameter for pass-by-reference, simply prepend an ampersand symbol (&) before the name in the parameter declaration:
Variable &num1, num2
str1= "The number is"
and then call the function with the name of a local variable in the reference slot:
Variable num= 1000
String str= "hello"
print str, num