Functions
Learning Objectives:
Building -
Define a function and pass a value into that function to be used
Linking & Using -
Explain the purpose of using functions within programs and incorporate user input as parameters that are passed to the function
Extending -
Combine arrays, selection, iteration and Boolean with the use of functions.
Functions are a great way of organising your code and are the key to good coding
You can create a function and run it as many times as you want anywhere in your code. Variables you create in a function are called local variables and only work in that function.
Variables that are in your main body of code, called global variables, won't work in a function, although there are ways round this.
You can feed lots of things into a function. You put these into the brackets (parenthesis) and you can get one thing out by returning it.
You can create a function and run it as many times as you want anywhere in your code. Variables you create in a function are called local variables and only work in that function.
Variables that are in your main body of code, called global variables, won't work in a function, although there are ways round this.
You can feed lots of things into a function. You put these into the brackets (parenthesis) and you can get one thing out by returning it.
|
Linking & Using:Paired programming task:
Take turns Driving/Navigatig to complete the challenges in this document:
Extending:
Continue your online course @ Codecademy
|