Parameter passing in method
NEED DATA TYPE IN PARAMETER
Returning from method
Public “data type” methodName
At the end of method
Return ; }
Can have return statement within if-elif-else statement.
Code finishes when return statement is read
What is method?
The part where you’re actually having code written for a method type. I.e functions
Class {
Method {}}
Class main {
Call methods;
}
Local variables
In methods, they contain local variables and if you want something to use outside got to return it
Basically just a function in python.
Instance variable va local variables
Instance variable belongs to a class.
Local variable belongs to a method