A function can execute some lines of code only when you call it.
When you want to stop you code only working in an if statement, elseif statement, else, while, for, or function statement, you place an end, i.e.
value = 2
if value == 1 then
Print("Value is one!")
end -- I don't want the rest of the code only to work if value == 1
print("Done")
This will only print “Done!” because 2 ~= 1.
A Boolean value is basically the code term for a true or false value.
The syntax (Order you type something in, how it’s supposed to look) for an if statement is simple.
if <insert Boolean> then
<insert code to run when above Boolean is true>
end -- Finishes the if statement
I explained what Strings are in my second post, but I think you missed that. I’ll say it again; A string is basically what you call any text, and you put it in quotes (“”) to make it.
example = 1 -- No quotes makes it an Integer.
example = "1" -- Quotes make it a String
Parameters (I’m pretty sure that’s how it’s spelled, but it’s different in different programming languages, sometimes called arguments.) are any extra data you want to give to a function, i.e.
function sayText(text) -- This function has a parameter called text. If you call this
-- function, you must have the parameter.
print(text) -- Using the parameter text we defined, we pass it on to the built-in function print.
end -- End the function.
sayText("Hello, world!") -- Call our function sayText, with the parameter text as "Hello, world!"
For loops are more advanced, but essentially if we say
for value = 1, 10 do
print("The value is " .. value .."!")
end
it will run the code after the do and before the end as many times as needs so that it runs it 10 times, the first with value = 1, the second with value = 2, and so on, up to value = 10. S the output will be:
The value is 1!
The value is 2!
The value is 3!
The value is 4!
The value is 5!
The value is 6!
The value is 7!
The value is 8!
The value is 9!
The value is 10!
If statements, functions, and how everything else works is a completely different topic, that’s basically learning how to make your own programming language. I hope to learn how to do it some day, but for now just knowing it works is good enough.
Sorry for lots of notes, huge posts and clutter, but it can be hard to explain some things.
Glad to be able to help!