Methods Flashcards
1
Q
Parameter passing in method
A
NEED DATA TYPE IN PARAMETER
2
Q
Returning from method
A
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
3
Q
What is method?
A
The part where you’re actually having code written for a method type. I.e functions
Class {
Method {
}}
Class main {
Call methods;
}
4
Q
Local variables
A
In methods, they contain local variables and if you want something to use outside got to return it
Basically just a function in python.
5
Q
Instance variable va local variables
A
Instance variable belongs to a class.
Local variable belongs to a method