Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Are parenthesis needed here?

Is there a difference between this

local a = Instance.new(t, p or game.Workspace)

and this

local a = Instance.new(t, (p or game.Workspace) )

1 comment

2

Not really. :) Parentheses aren't necessary in this situation. :P In my opinion (or understanding), the Parentheses are like the Mathematical ways (Example: P.E.M.D.A.S.); Parentheses comes first (and I think this does the same affect for 'If' statements as well :o ) when it comes to a specific Mathematical term. :)

1 answer

✓ Accepted answer

In this case, there is no difference. However, if you wanted to say something like this:

local r = false
local a = Instance.new(t, (r and p or game.Workspace) )

It's better to have parentheses for expressions with several and's and/or or's

1 comment

0

...but the parenthesis would do better clarifying the o-o-o on the and and or, and not on the comma

This discussion is preserved as it was. New answers, comments, and votes are closed.