1. value parameters only for basic types?
- Posted by Tim Fraser <tfraser at TFRASER.SCREAMING.NET>
Feb 17, 2000
-
Last edited Feb 18, 2000
The man says "A copy of the value of each argument is passed in. The formal
parameter variables may be modified inside the procedure but this does not
affect the value of the arguments. "
Is there a way to pass a parameter for a basic type so that the original
(formal) parameter gets altered too?
2. Re: value parameters only for basic types?
Yes but what you have to do is not pass a variable in through the
procedure/function declaration, but just use a global variable. E.g.
procedure example(integer var)
var+=1
end procedure
Will have no effect, but
integer var
procedure example()
var+=1
end procedure
var=1
example()
Will do the job fine. Of course, there is another way, and that is:
integer var
function example(integer var)
var+=1
return(var)
end function
var=1
var=example(var)
Hope this helps!
>--- www.spectresoftware.co.uk <---