Re: [DOS] Can we emulate "pass by reference" in Eu?
On 18 Oct 2004, at 20:58, Alex Caracatsanis wrote:
>
>
> posted by: Alex Caracatsanis <CaracatsanisA at ramsayhealth.com.au>
>
> Dear List
>
> For my general knowledge, rather than with a specific program in mind, I'd
> like
> to ask how to pass a non-global variable (two scenario's: an atom; a sequence)
> as an argument to: 1 a procedure that changes the variable (eg increments it)
> 2
> a function that changes the variable (eg increments it) but returns some
> other,
> different, variable
>
> A "minimal" example to achieve the above, would be enough.
Not sure if this is what you meant ........
atom var1
sequence seq1
procedure add1(atom var2)
var1 = var2
end procedure
function add2(atom var2)
var1 += var2
return var1
end function
procedure app1(sequence seq2)
seq1 = seq2 & seq2
end procedure
function app2(sequence seq2)
sequence nothing
nothing = ""
seq1 = seq2 & seq2
return nothing
end function
procedure test()
atom var0
sequence seq0
var0 = 12
seq0 = "something"
add1(var0)
var0 = add2(var0)
app1(seq0)
seq0 = app2(seq0)
end procedure
test()
> Thank you
<curtsey>
Kat
|
Not Categorized, Please Help
|
|