01.11.2018, 04:44
You can do this on a few ways.
1) You can return before second if
2) You can nest your second if in the first
3) If in the first if there is only this secondd you can combine your conditions with AND gate
1) You can return before second if
Code:
if temp1 < temp2 then
-- do something
return -- could be with some value
end
if temp3 < temp4 then
-- do something
end
2) You can nest your second if in the first
Code:
if temp1 < temp2 then
-- do something
if temp3 < temp4 then
-- do something
end
end
3) If in the first if there is only this secondd you can combine your conditions with AND gate
Code:
if temp1 < temp2 and temp3 < temp4 then
-- do something
end
Done is better than perfect