What functions are?
Definition: function refers to a collection of statements by a name (function name) encapsulates, in order to perform this function, simply call it the function name.
DEF sayHi (): # function name Print ( " ! the Hello, the I'm the nobody " ) sayHi () # call the function
You can take parameters:
A, B = 5,8 C = A ** B Print (C) # used instead of the write function DEF Calc (X, Y): RES = X ** Y return RES # returns an execution result of the function C = Calc (A , B) Print (C)
characteristic:
- Reduce duplication of code
- Making the program may expand
- Making the program easy to maintain