Tips for golfing in dc
If-then-else statements

Suppose we want to check the condition a==b (let a and b be stored in their respectively-named registers).

edit:

[         # Everything is wrapped in one big macro
  [         # An inner macro for our *then* part
              # &lt;-- Stuff to execute if a==b here
  2Q          # Then quit the inner and outer macro
]sE       # `E' is for Execution register ;)
la lb =E  # if a==b, execute E
          # if E is executed, it will quit the whole macro, so the rest is never reached:
          # &lt;-- Stuff to execute if a!=b here
]x        # End macro; Execute


Let (foo) be a placeholder, for the purpose of condensing:

[[(then)2Q]sE(condition)E(else)]x


Pretty sure this is the most compact if statement possible (also featured here).