Skip to content

Commit

Permalink
add hello.rb and closure.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki45 committed Jun 14, 2012
1 parent 7cfaba5 commit 015fd6c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ruby/closure.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
def test
var = 0
Proc.new { var = var + 1 }
end

num = test
puts num[]
puts num[]

def ini
a = (1..100).to_a
Proc.new { a.shift }
end

arr = ini
puts arr[]
puts arr[]
50.times { arr[] }
puts arr[]
1 change: 1 addition & 0 deletions ruby/hello.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
put 'Hello'

0 comments on commit 015fd6c

Please sign in to comment.