pass by reference but reference to data and not to variable

Posted by dorelal on Stack Overflow See other posts from Stack Overflow or by dorelal
Published on 2010-04-14T04:49:00Z Indexed on 2010/04/14 4:52 UTC
Read the original article Hit count: 177

This is psesudo code. In what programming language this is possible ?

def lab(input)
  input = ['90']
end

x = ['80']
lab(x)

puts x #=> value of x has changed from ['80'] to ['90]

I have written this in ruby but in ruby I get the final x value of 80 because ruby is pass-by-reference. However what is passed is the reference to the data held by x and not pointer to x itself same is true in JavaScript. So I am wondering if there is any programming language where the following is true.

© Stack Overflow or respective owner

Related posts about ruby

Related posts about software-engineering