title: Haskell compare two int with if statement
body: <p>I want to implement a function named log2, which computes the integer log (base 2) of its argument. I can't use log function. My solution is: to check if x equals to 2^y. If x equals 2^y give the value y, if x doesn't equals to 2^y then y = y + 1. This will go on until y is found. This is what I got so far: </p>
  
  <pre><code>log2 x = y where y = 0
      if x == 2^y then y
      else y = y + 1
  </code></pre>
  
  <p>When I want to run this I will get this error: </p>
  
  <blockquote>
    <p>error: parse error on input `if'</p>
  </blockquote>
  
  <p>I am new to Haskell so can somebody explain me what's wrong?</p>