DEV Community

Discussion on: A pure functional Primality Test in Scala

Collapse
 
sshark profile image
TH Lim

The function is pure if it,

  1. always return the same value for the same input
  2. always accepts values and returns values
  3. only uses the values from its parameters i.e. the function not use values or variables outside of the function. So, if the mutation happens inside the function and the variable localized within the function, the function is considered pure.