RosettaCodeData/Task/FizzBuzz/CLIPS/fizzbuzz.clips

16 lines
524 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
(deffacts count
2026-02-01 16:33:20 -08:00
(count-to 100))
2023-07-01 11:58:00 -04:00
(defrule print-numbers
2026-02-01 16:33:20 -08:00
(count-to ?max)
=>
(loop-for-count (?num ?max) do
(if (and (= (mod ?num 3) 0) (= (mod ?num 5) 0) ) then
(printout t "FizzBuzz" crlf)
else (if (= (mod ?num 3) 0) then
(printout t "Fizz" crlf)
else (if (= (mod ?num 5) 0) then
(printout t "Buzz" crlf)
else
(printout t ?num crlf))))))