ECS 10 Lecture Notes - Lecture 4: Local Variable, Global Variable
Document Summary
You can create a function using the alphanumeric rules as it follows: def functionname (parm1name, parm2name) This will define the code that will run when it is called, and it needs to be indented to belong to the function. the indent is part of the syntax. Functions does not activate unless they are called by the user. The scope of a variable is the area that the variable exists in, so the functions will reference only their variables, and if you try to reference them outside the area, then they will return an error. Functions will pass a copy through the code, not the actual object inside the variable. Parameters are the arguments found inside the function creation. A return value will return what the function outputs. returns can return nothing at all. By default the function will return none.