Tips for golfing in dc What general tips do you have for golfing in dc? 

dc is a calculator utility for UNIX/Linux that predates the C language. I am interested in how to make my dc programs (calculations?) shorter. I'm looking for ideas that can be applied to general code-golf that are at least a little bit specific to dc (eg. removing comments is not a helpful answer)

Please post one tip per answer.
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).