News for hackers. Stuff that matters.
Re:Stack Overflow: Printing 1 to 1000 in C by xentronium on Monday March 14, 2011 @03:23PM (#2323986)
Will this count for solution? :)

    MAX = 1000

    def execute_if_not_equals(value, other, &block)
      noop = lambda {}
      [block, noop][value / other].call
    end

    def print(i)
      execute_if_not_equals(i, MAX) do
        puts(i + 1)
        print(i + 1)
      end
    end

    print(0)

[edit]: updated to not use != operator which is probably a cheat.

There are no comments on this comment yet.