Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What does "end" in scripting generically meant to do?

Asked by 10 years ago

What's end supposed to do? If it was what I thought it was, then it'd be at the end of all you wrote, like a period. But it continues on in code. Why does there have to be an end at the end of everything you do? Because in my thought if it was to have an "end", then nothing would go after the "end", but you can type more after it?? Could somebody explain to me the general way that end works?

1 answer

Log in to vote
2
Answered by
Damo999 182
10 years ago

Ends are used to end certain statements such as if , else,for and other statements you could consider an end to be a period it basically ends a block of code. Depending on how many statements you have will determine how many ends you need at the end of a script.

if 5 == 5 then
    print("True")
end-- ending of a block of code

if 5 == 5 then
    print("HI")
else
    if 5 ~= 5 then
        print("False")
    end
end -- this has two statements therefore two ends are needed to end code. So in conclusion is is used to end blocks of code

print("pie") -- this doesn't need an end because there are no statements.

0
Thank you for helping me out, I've been wondering why you have to put an end, to make the script complete. I know it's somewhat alike to a period, but it's alittle different, it confuses me time, but thanks!! BugQuestioner -4 — 10y
0
Yeah no problem just think of it as a period to the ending of a sentence in this case the end of a block of code :). Damo999 182 — 10y
Ad

Answer this question