resource factorial()
  procedure fact(int v) returns int   r{
    # v is assumed to be positive
    if (v == 1) { r = 1
    } else if (v > 1 ) { r = v*fact(v-1)
    }
  }
  int n = 0
  # writes("enter a positive integer: "); read(n)
  while (n < 10) {
     n++
     write("the factorial of", n, "is", fact(n))
  }
end
