CS2613/labs/L04/recursion.rkt

9 lines
194 B
Racket
Raw Normal View History

2022-09-22 16:16:55 -03:00
#lang racket
(define (fact n)
(cond
[(zero? n) 1]
[else (* n (fact (sub1 n)))]))
(module+ test
(require rackunit)
(check-equal? (fact 10) 3628800))