I'm surprised noone answered OP's question so far. So going back: 
    
    
    proc fac(0): int = 1
    proc fac(n: int): int = n*fac(n-1)
    
    
    Run

Since Nim is not a functional, but imperative language, you would use runtime 
flow control in this case: 
    
    
    proc fac(n: int): int =
      if n == 0: 1
      else: n * fac(n - 1)
    
    
    Run

Reply via email to