title: This Value is Not a Function and Cannot be Applied F#
body: <p>I have been trying to write a program in F# which takes two values (a tuple): a number and a string. Depending on whether the string tells the program to add or multiply, it will add or multiply the input number with all the integers from 1 to that number (i.e. 1..n).</p>
  
  <p>Here is the code       </p>
  
  <pre><code>let addormult (n:int, what:string) = 
      if what = "multiply" then 
         let rec product n = 
             if n&lt;1 then 0
             else n*product(n-1)
         printfn "%A" product
      elif what = "sum" then
           let rec sum = 
               if n&lt;1 then 0
               else n + sum(n-1)
           printfn "%A" sum
  </code></pre>
  
  <p>However, every time I try to run this function, I get the error</p>
  
  <blockquote>
    <p>"This value is not a function and cannot be applied."</p>
  </blockquote>
  
  <p>So what am I doing wrong?</p>