Use of operator 'and' Jess -


how use correctly operator 'and' in jess?

example of (wrong) code:

(test (and (>= ?x ?minx) (and (<= ?x ?maxx) (and (>= (+ ?x (- ?y1 ?y)) ?minx) (and (<= (+ ?x (- ?y1 ?y)) ?maxx) ... 

also, in if clause, how use that?

thanks.

i added indents code try understand you're doing:

(test     (and (>= ?x ?minx)          (and (<= ?x ?maxx)               (and (>= (+ ?x (- ?y1 ?y)) ?minx)                    (and (<= (+ ?x (- ?y1 ?y)) ?maxx) 

there missing ")"s @ end i'll assume that's not issue. basically, if you're trying express conjunction of bunch of conditions, need 1 and, , give many arguments need. so, example, like

(test     (and (>= ?x ?minx)          (<= ?x ?maxx)          (>= (+ ?x (- ?y1 ?y)) ?minx)          (<= (+ ?x (- ?y1 ?y)) ?maxx))) 

as far if goes, it's pretty documented in the manual:

(if (> ?x 100)     (printout t "x big" crlf)  elif (> ?x 50)     (printout t "x average" crlf)  else     (printout t "x small" crlf)) 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -