What is a function?
A named list of statements
What is a function call?
invoking the function’s name, causing the statement to execute.
What is a local variable?
A variable declared within the function. It can only be used within that function.
What is a parameter?
Function input specified within a function call.
For example: PrintPizzaArea(12), (12) in the parameter.
What is an argument?
A value provided by the parameter during a function call.
During arguments, should function calls have words inside the parentheses?
No.
Bad Example: numVal(integer 23, 2)
How can a function return one value?
Assigning a return variable with a return value.
Can a function return more than one variable?
No, it can only return one.
If a function that does not return a value cannot be used in an expression. Instead use?
outputData (x, y)
The variable goes on which side of a statement?
The left
Example of a variable x
What side of a statement does an expression go on?
The right
Example of an expression numsVal + 1 or squareroot (49.0)
What is modular development?
Separating a program into segments, testing them individually, and later combining all parts together into a single program.
What is incremental development?
writing a portion of a program, testing it, then writing a bit more, testing, rinse and repeat.
What is a function stub?
A function whose statement(s) are yet to be written.
How to prevent redundant statements?
By writing functions, they can be called from multiple places within the program.
How to easily identify a function call?
statement has function name quickly followed by parentheses
Example: functionName( )
How to identify a method function?
It uses a ( . ) dot
Example: name.upper ( )
How to identify a user-defined function?
It does not use a ( . ) dot
Example: attack ( )
When writing code in coral how does a function start?
With the word function followed by the function’s name.
How is a function definition setup?
the word “function.”
the function’s name
function parameters in parentheses (use commas if more than one)
Then the return indicator.
What goes inside the parentheses for a function definition?
parameter type followed by the parameter name.
Examples: (float num1) or (integer userAge)
Can a parameter contain an expression inside it?
No
Example: (integer UserName + 5 )
When a program first executes, what is the first function “called”?
Main() is always the first function called, to start the programs execution.
If you want a function to return something what must the function definition have at the end?
The word “returns” the variable type and the name.
Example: returns float numVals