Skip to content

Instantly share code, notes, and snippets.

@LolWalid
Created December 16, 2015 15:49
Show Gist options
  • Select an option

  • Save LolWalid/feacc676a304ff477e33 to your computer and use it in GitHub Desktop.

Select an option

Save LolWalid/feacc676a304ff477e33 to your computer and use it in GitHub Desktop.
All is reference !
# toute donnée est un objet, y compris les types ;
# toute fonction est une méthode ;
# toute variable est une référence à un objet ;
a = [1, 2, 3]
b = a
a << 4
b
def add(array, x)
array << x
end
def double(array)
array.map! { |e| e * 2 }
end
add(a, 42)
a
double(a)
a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment