Skip to content
Newer
Older
100644 9 lines (7 sloc) 107 Bytes
0768eb0 @mark-moseley SVN RubyForge pull
mark-moseley authored Jul 21, 2009
1 #!/usr/bin/env ruby
2 def triangle(n)
3 (0..n).inject do |sum, i|
4 sum +=i
5 end
6 end
7 puts triangle(3)
8
Something went wrong with that request. Please try again.