| 1. |
What Is A Pure Function? |
|
Answer» A PURE function is a function without any observable side-effects. That means it returns always same results irrespective how many times we call it with same inputs. A pure function always gives same output for the same inputs. For EXAMPLE:- scala> 10 + 20 Here “+” a pure function available in Int class. It gives same result 30 for same inputs 10 and 30, irrespective how many times we call it. A pure function is a function without any observable side-effects. That means it returns always same results irrespective how many times we call it with same inputs. A pure function always gives same output for the same inputs. For Example:- scala> 10 + 20 Here “+” a pure function available in Int class. It gives same result 30 for same inputs 10 and 30, irrespective how many times we call it. |
|