How to make non-nested if statements

How do i make non nested if statements?

these are what my if statements look like:

if then
if then

end
end

easy - just dont do it, use and, or keywords

if this and that then end, use and or or statements if needed.

example:

if 1 == 1 then
    if 2 == 2 then
        
    end
end

if 1 == 1 and 2 == 2 then
end
-- they essentially do the same
1 Like

Instead of using

if something then
	-- :: Do smth
end

Use

if not something  then
	-- :: If you are in function
	return
	-- :: If you are in a loop (for, while, repeat)
	continue
	-- :: If you are in a loop and you want to stop it
	break
end

-- :: Do smth

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.