Skip to content

Instantly share code, notes, and snippets.

@tomcha
Created July 30, 2014 13:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomcha/fa279a63ca2006af7f82 to your computer and use it in GitHub Desktop.
Save tomcha/fa279a63ca2006af7f82 to your computer and use it in GitHub Desktop.
Rubyのサンプル
#!/usr/bin/env ruby
# encoding: utf-8
#値渡し
array_a = [0,1,2]
array_b = array_a.dup
array_b[1] = 'a'
p array_a
#参照渡し
array_c = [0,1,2]
array_d = array_c
array_d[1] = 'a'
p array_c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment