Function Part 2
Function Part 2
Function Part 2
IMPLEMENTATION
CHARACTERISTICS OF INTERFACE
Interface and Implementation - example
TYPES OF FUNCTION
• PURE FUNCTION
• IMPURE FUNCTION
PURE FUNCTION
• Give the exact result when same arguments are
passed.
• No side effects.
• No external variable
Same input – Same output
Example:
Sin(0) is 0
Sin(1) is 1
SHOULD NOT HAVE AN EXTERNAL VARIABLE
Example
Let square x
return x * x
NO SIDE EFFECTS
No
mutating
calls
No Logging