I'm not sure what the difference is, can someone explain?
think of it like this: say your about to send someone at the store to buy you some games, and you tell them this: if there's Fortnite then then buy it, else if there's not fortnite but there's GTA 5 then buy the GTA 5 else just buy a carton of milk.
notice here, the first if
indicates the preferred choice(in the example being buy Fortnite, the else if
is the second preferred case if the first case cannot be satisfied(in the example being buying GTA), the else
is basically the last resort if any of the previous cases cannot be met.
another example:
if Jailbreak is better than Mad City then
Play(Jailbreak)
elseif MadCity:HasMoreContentThan(Jailbreak) then
Play(Mad City)
elseif MadCity == Jailbreak then
Play(Jailbreak)
else
print("There's no fun games on roblox")
end
put the emphasis on the fact that you can have multiple elseif
s
elseif
(not else if
) should be used when you want another condition before running code
else
should be used when you don't want another condition before running code