I have seen multiple cases in which a developer does the following;
if conditional == true then
do
-- code here
end
end
Instead of the following;
if conditional == true then
-- code here
end
Does the do
help/change anything? Why would developers chose to use do
in conditionals?
1 Like
7z99
(cody)
May 27, 2024, 12:40am
#2
It’s all up to preference and doesn’t do much. It just creates another scope inside of your if statement, along with making your code more verbose.
3 Likes
No. Do here is useless and you can use it only inside loops or when iterating. It just makes the code with another end and groups the code, which can be based on preferences.
2 Likes
Ah appreciate the reply, Seems more likely than it actually doing smt lol
system
(system)
Closed
June 10, 2024, 1:59am
#5
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.