User:JulienDethurens/Guide/Chapter 4
This page talks about some subjects that could be useful to know about. You can read these at any time, there is no specific moment to read them, so you don't need to read them completely at the end. However, some of these assume you have some prerequisite knowledge, so you might only be able to understand some of these after reading a certain part of the guide.
Indentation
Indenting code means using tabulations (or spaces, but I prefer tabulations) to indent code, to make it more organized.
Usually, a new level of indentation is added on every new block of code, or every scope, if you prefer. Some also do it for tables and in long comments.
Here is an example of indented code:
for i = 1, 50 do
if math.random(5) == 3 then
print(string.format("The number is %d.", i))
elseif math.random(15) == math.random(10) then
print(math.random(5) + i)
break
end
end
And here is the same code, without indentation:
for i = 1, 50 do
if math.random(5) == 3 then
print(string.format("The number is %d.", i))
elseif math.random(15) == math.random(10) then
print(math.random(5) + i)
break
end
end
Indented code looks much better and indenting your code will make it much more organized and will be extremly helpful. Trust me, you should always indent code, even if you think it's not worth it.