Conditional Question

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

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

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