multiple condition

multiple condition

mduvalAA6EJ
Enthusiast Enthusiast
280 Views
3 Replies
Message 1 of 4

multiple condition

mduvalAA6EJ
Enthusiast
Enthusiast

hello,

 

can i write code like this use AND?

thank you..

(if
(and
(/ SS_NO1 "%%")
(/ SS_BAKNO1 "%%")
(/ SEQREV1RN1 "%%")
(/ SEQREV1RN2 "%%")
(/ SEQREV1RN3 "%%")
(/ SEQREV1RN4 "%%")
(/ SEQREV1RN5 "%%")
(/ SEQREV1RN6 "%%")
(/ SEQREV1RN7 "%%")
(/ SEQREV1RN8 "%%")
(/ SEQREV1RN9 "%%")
(/ SEQREV1RN10 "%%")
(/ SEQREV1RN11 "%%")
(/ SEQREV1RN12 "%%")
(/ SEQREV1RN13 "%%")
(= SEQREV1RN14 "%%")
);end and
(setq NEW-SEQREVRN14 SS_NO1)

0 Likes
281 Views
3 Replies
Replies (3)
Message 2 of 4

ВeekeeCZ
Consultant
Consultant

Why not. But not equal is /=

/ is division.

Message 3 of 4

ronjonp
Mentor
Mentor

Could be written like this too:

 

(and (vl-every '(lambda (x) (/= x "%%"))
	       (list ss_no1	     ss_bakno1	     seqrev1rn1	     seqrev1rn2
		     seqrev1rn3	     seqrev1rn4	     seqrev1rn5	     seqrev1rn6
		     seqrev1rn7	     seqrev1rn8	     seqrev1rn9	     seqrev1rn10
		     seqrev1rn11     seqrev1rn12     seqrev1rn13
		    )
     )
     (= seqrev1rn14 "%%")
     (setq new-seqrevrn14 ss_no1)
)

 

Message 4 of 4

john.uhden
Mentor
Mentor

@mduvalAA6EJ 

OR (I don't mean the function OR)

  you might be able to skip the IF part and use the Kosterian usage of just the AND function, as in...

(and

  (/= this "A")

  (/= this "B")

 ; etc.

  (do_something_with this)

)

because the AND function keeps evaluating each operation within until one returns nil.

But actually, your example might be simplified and shortened by...

(if (not (vl-position this '("A" "B" "C" etc.)))

  (do_something_with this)

)

;; Of course the do_something_with function is up to you.  😲

HTH

John F. Uhden