ECS 10 Lecture 6: Lecture 6 (April 8)

32 views1 pages

Document Summary

Function is a named collection of instructions that performs some operation and can be invoked from within our program. A function definition consists of a function header and a function body, The function header is the first line of the function. It includes the function name followed by a list of variables in parentheses. The function body consists of the instructions to be executed when that function is called. The lines of the function body must all be indented. That indentation is typically four spaces. cube(number) = number. The names of the variables shown in the parameter list are called formal parameters. The actual values passed to the function are called actual parameters. Actual parameters are called arguments, or we just use the word parameters. return result vs print(result) Return hands a value to whatever called the function.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents