News for hackers. Stuff that matters.
Re:Ruby Is The Future by namelessmike on Wednesday April 01, 2009 @08:25PM (#542711)
C# 3:

  (1).UpTo(10).ForEach(x => Console.WriteLine(x));
Of course, "UpTo" requires first extending int, which is trivial:

  public static class IntExtensions {
      public static List<int> UpTo(this int start, int end) {
          var range = new List<int>();
          for(int i = start; i < end; i++) {
              range.Add(i);
          }
          return range;
      }
  }
Re:Ruby Is The Future by _pius on Wednesday April 01, 2009 @10:41PM (#542832)
That's cool and all, but I think being able to do this natively in Ruby wins:

  p *1..10
Edit: you may need to do a "require 'pp'" first.