title: Difference between pure and impure function?
body: <p>I assumed that pure functions must always have a return type (i.e., must not be <code>void</code>) and must have the same output regardless of the state of the object and that Impure functions change the state of the object or print the state of the object.</p>
  
  <p>But the textbook I use states that: </p>
  
  <blockquote>
    <p>An accessor usually contains a return statement, but a method that prints information about an objects state may also be classified as an accessor.</p>
  </blockquote>
  
  <p>I'm confused. Which one is correct?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>A bit of clarification,The thing that makes me ask is this question:
  <img src="https://i.stack.imgur.com/B23YJ.png" alt=""></p>
  
  <p>The last question is to "<em>Give the type of function used</em>", and the people who commented there stated that it is an impure function as it is printing.</p>
  
  <p>So is this function pure or impure? </p>