Re: simple question: pointer equivalent in ruby
- From: Parker Selbert <parker@xxxxxxxxxxxx>
- Date: Sun, 17 Oct 2010 11:15:58 -0500
Shea Barton wrote in post #954956:
OR even
value = 5
othervalue = value
othervalue = 3
value (should be 3)
That is precisely how ruby works by default. If you wanted othervalue to
just take the 'value' of value, i.e. 3, you would use this instead:
value = 5
other = value.dup
puts other #5
other = 3
puts other #3
puts value #5
--
Posted via http://www.ruby-forum.com/.
.
- Follow-Ups:
- Re: simple question: pointer equivalent in ruby
- From: David A. Black
- Re: simple question: pointer equivalent in ruby
- References:
- simple question: pointer equivalent in ruby
- From: Shea Barton
- simple question: pointer equivalent in ruby
- Prev by Date: simple question: pointer equivalent in ruby
- Next by Date: Re: simple question: pointer equivalent in ruby
- Previous by thread: simple question: pointer equivalent in ruby
- Next by thread: Re: simple question: pointer equivalent in ruby
- Index(es):