I saw many people doing this:
Nest = (Nest or 1)
What is the point of the brackets? They could just write
Nest = Nest or 1
I also saw people doing these:
repeat
local MyVar = true
for i = 1, 10 do
i += 1
local random_num = math.random(1, 5)
if random_num == 3 then
local MyVar = false
break
end
end
until (not MyVar or i == 10)
People also use them in if statements.
1 Like
You’ll almost always use () for organizing your code with lots of math, CFrame, Color3, Vector3, and some other items. Using () is not always needed unless you’re doing some pretty complex CFrameing, but other than that, Roblox’s systems will almost always automatically add these brackets for you when needed. Nothing to stress about!
2 Likes
two reasons, grouping, and organization
In some cases people do it just to show their intent for the if statement (organization)
In other cases its to group multiple (not) (or) or (and) for the if statement to work properly
2 Likes