Sha256: 7437de360d10af130dd02eab2ab055a34bd94ecf205b8f729bfb19ab035cc153
Contents?: true
Size: 745 Bytes
Versions: 4
Compression:
Stored size: 745 Bytes
Contents
class TestMassign def self.main a, b = 1, 2 p a p b puts "--" a, b = 1, 2, 3 p a p b puts "--" c = 5 a, b, c = 1, 2 p a p b p c puts "--" @a, b, @c = 1, 2, 3 p @a p b p @c puts "--" puts "swap" # swap a, b = 1, 2 p a p b a, b = b, a p a p b puts "--" puts "splat1" a, b, c, *d = 1, 2 p a p b p c p d puts "--" puts "splat2" a, *b = 1, 2 p a p b puts "--" puts "splat3" a, *b = 1, 2, 3, 4, 5 p a p b puts "--" puts "splat with globals" p $a p $b $a, $b = 1, 2 p $a p $b puts "--" #TODO: a, b = 1 (to_ary) end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
superchris-rubyjs-0.8.2 | test/test_massign.rb |
rubyjs-0.8.0 | test/test_massign.rb |
rubyjs-0.7.1 | test/test_massign.rb |
rubyjs-0.7.0 | test/test_massign.rb |