[ create a new paste ] login | about

Link: http://codepad.org/sy5gpviW    [ raw code | output | fork ]

Ruby, pasted on Mar 4:
1
2
3
p (1...1000).inject(0) { |s, i|
  if i % 3 == 0 || i % 5 == 0 then s += i end
}


Output:
1
2
3
4
5
Line 2: undefined method `+' for nil:NilClass (NoMethodError)
	from t.rb:3:in `inject'
	from t.rb:1:in `each'
	from t.rb:1:in `inject'
	from t.rb:1


Create a new paste based on this one


Comments: