I'm trying an if condition inside a while condition in clips, but it doesn't work
(defglobal ?*global* = 38)
(defrule print
=>
(printout t "Guess the number: " crlf)
(bind ?guess (read))
(while (<> ?guess ?*global*)
(if (> ?guess ?*global*) then (printout t "The number is lesser, try again: " crlf)
[else (printout t "The number is greater, try again: " crlf)]
)
(bind ?guess (read))
)
(printout t "You succeed!" crlf)
)
It doesn't read the if condition only the next bind one, any advice?
Aucun commentaire:
Enregistrer un commentaire