News for hackers. Stuff that matters.
Re:Errors are values by zzzcpan on Monday January 12, 2015 @09:12PM (#8877726)
How about just using beloved tables instead? Maybe even with function literal to prepare some stuff, if you need to.

   for _, s := []string {
      p0[a:b],
      p0[c:d],
      // ...
   } {
      _, err = fd.Write(s)
      if err != nil {
         return err
      }
   }
As others already implied it could have been cleaner with exceptions, but I don't think this is that one case where exceptions are particularly important. There is no recursion yet or anything like that.

There are no comments on this comment yet.