Tell me more ×  I have been reading alot about functional
programming and f#. I have a snippet of code that I cannot
understand. I am familiar with recursive programs but this
particular code is bugging me  open System  let rec fact x =
if x < 1 then 1     else x * fact (x - 1)  fact 6  In this
snippet of code there is no where in the code that terminates
the recusion. How does this program know when to stop. If I
programmed this in c# I would tell the program to stop recursing
when the index or iterator is higher then 6.  share|improve this
question The index in this case is x and since it's counting
down from 6, checking whehter it's higher than 6, would be what
leads to an infinite loop. Checking whether it's less than 1,
which this code does, is exactly right. Also note that this
corresponds quite closely to the mathematical definition of
factorial. –  sepp2k Sep 4 '10 at 3:47 Worth noting that this
has nothing to do with functional programming. –  Jon Harrop Sep
4 '10 at 14:26 there is code that term