Week 3 Chapter 3 Functions Flashcards
What happens when you define a function?
Specifying the name and the sequence of statements
When a function is called what is the value in parentheses usually called?
Usually called the argument
What is the official name for a result of a function?
Return value
When int converts floating-point values to integers, what does it do?
It take the fraction part away and returns value like that
What would 3.9 look like when converted to integer?
3
What data types can float convert?
Strings and floating point numbers
What is a module?
File that contains a collection of related functions
Before we can use a module what do we have to do?
Have to import said module
What does dot notation format look like?
Math.log(23)
What is one of the most useful things about programming?
Ability to take small building blocks and compose them.
Where can you not put a arbitrary expression?
On the left side of an assignment value
The left side of an assignment statement has to have what?
A variable name
What does a function definition do?
It specifies the name of a new function and the sequence of statements that execute when the function is called.
What are the rules for function names?
Can’t have keywords, illegal characters, and the start has to be a letter not a number.
What should you avoid with function names?
Having a variable and a function with the same name
What do empty parentheses after a function name indicate?
That it doesn’t take any arguments
What is the first line of a function definition called?
A header
What is the other part of a function definition called (besides header)?
The body