<p>In Ruby, is it possible to pass by reference a parameter with value-type semantics (e.g. a Fixnum)?
I'm looking for something similar to C#'s '<strong>ref</strong>' keyword.</p>

<p>Example:</p>

<pre><code>def func(x) 
    x += 1
end

a = 5
func(a)  #this should be something like func(ref a)
puts a   #should read '6'
</code></pre>

<p>Btw. I know I could just use:</p>

<pre><code>a = func(a)
</code></pre>

Ruby doesn't support "pass by reference" at all. Everything is an object and the references to those objects are always passed by value. Actually, in your example you are passing a copy of the reference to the
```
Fixnum
```
Object by value.
The problem with the your code is, that
```
x += 1
```
doesn't modify the passed
```
Fixnum
```
Object but instead creates a completely new and independent object.
I think, Java programmers would call
```
Fixnum
```
objects
immutable
.