#explain what "return" does in scratch terms

1 messages · Page 1 of 1 (latest)

short heath
#

i used to code on scratch and it will help if you put it in scratch terms

short heath
#

why is function by itself

#

cant youi do it with just myFunction

echo swallow
#

What

short heath
#

i dont understand the difference the "return" makes

echo swallow
#

To anything

short heath
#

okay i think ill just remember to always use it in a function without fully knowing what it does

#

update i think i understand now ```local function add(num1, num2)
local result = num1 + num2
return result
end

local sum = add(10, 10)
print(sum)```

kindred root
#

if you have a function now you want to seperate code from other to make it more readable or scalable

#

but if you need a value or similar then you can use the functions to get these

echo stream
stoic hound
#

You will make yourself a great programmer

mental needle
#

return returns the value