Arc Forumnew | comments | leaders | submitlogin
2 points by tokipin 6043 days ago | link | parent

as sacado wrote, you would write it:

  (if (is x 0)
      1
      2)
a nifty thing here is that the if expression returns the value of whichever expression is selected, so you can do:

  (prn (if (is x 0)
      1
      2))
which would be the equivalent of the algol:

  print if x==0
      then 1
      else 2
which would print either 1 or 2. same goes for any other form, including such things as case statements

also, check out the tutorial. despite it being being in .txt (probably for formatting purposes,) it's actually good:

http://ycombinator.com/arc/tut.txt

ken's reference site is also darn handy:

http://arcfn.com/doc/index.html



1 point by sacado 6043 days ago | link

Yep. if actually behaves likes the ?: operator in C

  printf ("%d\n", x == 0 ? 1 : 2);

  (prn (if (is x 0) 1 2)

-----