Functions


What is a function?

Functions are a tool that help us wrap our code into one neat package that we can give a name, and then call that name anywhere in our program and it will run the code contained within it. Functions can help to keep our code neat and concise and avoid repeating the same things over and over.

Functions

Create a function

Select functions from the blocks menu and drag it to the coding area. Enter a new name for your function in the text box provided on the block.

Functions_user1

Using a function

When we add a function to the coding area a new block will appear in the function blocks menu. We can add this block to other parts of our code and it will represent whatever code is put inside the main function block.

Functions_user2

results matching ""

    No results matching ""

    results matching ""

      No results matching ""