Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Instead of

  if expr {
      n = trueVal
  } else {
      n = falseVal
  }
Just do

  n = expr

!


I think you're meant to read "trueVal" as "the value I want n to have if expr is true", not as literally true. And vice versa.


should be easy enough to do a "choose" stmt in golang, stolen from a business lang called Clarion, but expanded to include closures: n = choose(expr,14,choose(expr2,15,some code that returns something))




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: