Here's a comparison
for i,v in pairs(game.Workspace:GetChildren()) do
if v:IsA('Tool') then
end
if v:IsA('Part') then
end
end
for i,v in pairs(game.Workspace:GetChildren()) do
if v:IsA('Tool') then
elseif v:IsA('Part') then
end
end
Logic wise these aren't the same thing. A more apt comparison would be
for i,v in pairs(game.Workspace:GetChildren()) do
if v:IsA('Tool') then
elseif v:IsA('Part') then
end
end
for i,v in pairs(game.Workspace:GetChildren()) do
if v:IsA('Tool') then
end
if not v:IsA('Tool') and v:IsA('Part') then
end
end
In this one you could just use an elseif instead of two if statements since they do the same thing logic wise.
Just depends on what you need them for but you can make do without an elseif if you really wanted to, but at the cost of a bit of organization within your code.
2 comments
A thing to note, elseif statements are very important in some codes that are very variable reliant as otherwise you may run into the issue of an unintended if statement running because a previous one set the variable to what the next required before the if statement runs, thus causing the next one to run even if it wasn't supposed to.
Without elseif statements, it could make each subsequent if statement more complicated if you have multiple if statements working on one variable, so while it's possible it's not practical.