Created
July 30, 2014 13:29
-
-
Save tomcha/fa279a63ca2006af7f82 to your computer and use it in GitHub Desktop.
Rubyのサンプル
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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