Shop OBEX P1 Docs P2 Docs Learn Events
Syntax question — Parallax Forums

Syntax question

Don MDon M Posts: 1,653
edited 2011-02-13 19:55 in Propeller 1
Is: if (d == $0_00)

the same as: if d == $0_00 ?

Does it matter if you use the parenthesis?

Thanks.
Don

Comments

  • kuronekokuroneko Posts: 3,623
    edited 2011-02-13 16:37
    It's the same for this simple expression (some people use them anyway as it's mandatory in C). It becomes more important when you want to change precedence for more complex expressions, e.g. (A+B)*C is not always the same as A+B*C.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2011-02-13 19:39
    Using the outer parens is a matter of style and taste. I prefer to use them in my programs, since they visually encapsulate the conditional. But it's not at all necessary.

    -Phil
  • Don MDon M Posts: 1,653
    edited 2011-02-13 19:55
    Fully understood. Thank you for the replies.
Sign In or Register to comment.