As I understand it, doing
1 | while true do |
2 | --code |
3 | wait() |
4 | end |
is considered better than doing
1 | while wait() do |
2 | --code |
3 | end |
Why is this?
It isn't bad, people just say it's bad practice. wait()
is a ROBLOX Lua function, the reason it works is because wait()
returns values making it true
. It's bad practice because if you were to move on from ROBLOX's engine, your loops wouldn't work because wait()
wouldn't return anything.
I got this information from this video by ScriptGuider:
Marked as Duplicate by User#24403
This question has been asked before, and already has an answer. If those answers do not fully address your question, then please ask a new question here.
Why was this question closed?