function pureFunction(a) { return a + 2; } pureFunction doesn’t modify the variable outside of its scope, i.e., “x”. It a nutshell pure function doesn’t have side effects. Impure function An impure func
Now, let's create an impure function: Example: Constant multiplier objectMyObject{valconstant=12.4;defconstantMul(value:Int):Double={valresult=value*constant;return(result);}defmain(args:Array[String]){println("The result of constant multiplier is: "+constantMul(34))}} ...
Karkevandi-Talkhooncheh A., Rostami A., Hemmati-Sara- pardeh A., Ahmadi M., Husein M.M., Dabir B. (2018) Modeling minimum miscibility pressure during pure and impure CO2 flooding using hybrid of radial basis function neural network and evolutionary techniques, Fuel 220, 1, 270-282....