# Function that multiplies all numbers between “a” and “b” with do loop

I'm making a function that multiplies all numbers between an "a" input and a "b" input with do loop. If you please, check my function and say what's wrong since I don't know loops very well in Scheme.

(define (pi-function x y)
(let ((result y))
(do ((limI x (+ x 1)))
((= limI y) result)
(set! result (* result limI)))))


## migrated from stackoverflow.comJun 11 '11 at 0:43

This question came from our site for professional and enthusiast programmers.

You can use a do loop without using set!.
(define (product-of-range x y)