@turtlegamer-0 Try your best! You already use functions all the time - the blue instructions in your code are all functions. They always have a pair of round brackets at the end, sometimes with stuff inside.
When you use a Fuze function like print(), Fuze behind the scenes takes the stuff in the brackets and gives them to some more complicated code we wrote which then does a particular task, in this case making text appear.
But you can make your own! Here's a simple way to think about it:
A function is like a container you make for a section of code - this means you can just write the container name instead of copying and pasting all the code inside it:
// This is called defining a function
function showLoadingScreen()
clear()
textSize(100)
print("Loading...")
update()
return void
With this in our code, we can just say showLoadingScreen() instead of copying and pasting those 4 lines every time.
The thing to remember is that function definitions must be outside of any other loops/functions/ifs etc. I like to put them at the bottom of the program with a bookmark for the ones I'll be coming back to a lot.
But the really awesome thing you can do with functions is give them things, and receive them back. For a silly example:
// Defining the function:
function isNameDave(name)
isDave = false
if name == "Dave" or name == "dave" then
isDave = true
endif
return isDave
// Using (also called 'calling') the function:
playerName = input("What is your name?")
if isNameDave(playerName) then
print("hi dave")
else
print("you're not dave")
endif
This very silly function tells us if a name we give it is "Dave" or "dave" - now we can use just one line instead of having to copy and paste a whole if all the time!
Of course that exampe isn't very helpful really, but it's just to show you how they work!
Let me know if it would be helpful to show you an example quiz program that uses functions and arrays of questions/answers.