I’m writing because it appears that many people are confused by this keyword, and I feel it is generally misunderstood. I hope by the conclusion of this you will have a better understanding of it. First lets look at how returning works
Example(1)
the variables numb1 and numb2 haven’t been exposed globally yet so they must be defined in the functions parameters if you plan on using them within the function body
local function Multiply(numb1,numb2)
return numb1 * numb2
end
Multiply(5,10) – the value of this is relative to the number this time it’s equal to 50
This works like foo1*foo2 = “number” you can use this in your code raw or you can choose to put it in a variable like this
Local value = Multiply(5,10) – same thing
example (2)
Local bool = function(ev) – the declaration of this variables existence within the said function
local ev = true – even though i used the local keyword i still need to use return to withdraw this value
return ev – withdraws the value from the function
end
warn(bool) – true gets printed in output or false depend on the one you put in
hopefully you were able to understand this because it can be very useful also this posted is aimed toward newer/amateur coders also don’t bother responding to this it’s just a guide