My question is, would or use nested if statements or the and operator?
if debounce then
if hit == false then
end
end
or
if debounce and hit == false then
end
Which do you use and which is better? Thanks!
My question is, would or use nested if statements or the and operator?
if debounce then
if hit == false then
end
end
or
if debounce and hit == false then
end
Which do you use and which is better? Thanks!
whichever you want. the end.
dont argue over semantics and writing code.
Nested is generally more clean, I would use it most of the time except for shared conditions
For instance, debounce
local debounce = false
local function doStuff(player)
if not debounce then
if player:IsA("Player") then
elseif player:IsA("Humanoid") then
end
end
end
that is better than
local debounce = false
local function doStuff(player)
if not debounce and player:IsA("Player") then
elseif not debounce and player:IsA("Humanoid") then
end
end
but otherwise nested if statements are cleaner