Is it true

Discussion in 'AutoCAD' started by Adesu, Jul 27, 2004.

  1. Adesu

    Adesu Guest

    Hi Alls,is it true format for "if and or" ?,if we did wrong please corrected
    it,thanks a lot for your helps
    Best regards
    Ade Suharna

    (setq ask (getreal "\nEnter New Value: "))
    (if (and (= ask 1)(= ask 2)
    (or
    (= ask 3)(= ask 4)
    ) ; end of or
    ) ; end of and
    (progn
    ((setq a (list 0 0))
    (setq b (list 1 1))
    (setq c (list 2 2))
    (setq d (list 3 3)))
    ) ; end of progn
    ) ; enf of if
     
    Adesu, Jul 27, 2004
    #1
  2. Adesu

    Paul Turvill Guest

    You've created an impossible situation. Since 'ask' can have only one value
    (a real, even though the if function is looking for integers) returned by
    (setq ...), the (if ...) function will never run, since it's impossible for
    'ask' to equal both 1 and 2, not to mention 3 or 4. In order for the (if
    ....) function to do anything, 'ask' would have to be equal to 1 *and* 2,
    *and* either 3 or 4 (three different values) all at the same time.

    Perhaps you should explain what it is you're trying to achieve.
    ___

    <snip>
     
    Paul Turvill, Jul 27, 2004
    #2
  3. Adesu

    ECCAD Guest

    From structure point:
    ;(if (and (= ask 1)(= ask 2)
    ;(or
    ;(= ask 3)(= ask 4)
    ;) ; end of or
    ;) ; end of and
    ;(progn
    .................
    (if
    (and (= var1 1)(= var2 2));<-- note extra ")"
    (or
    (and (= var3 3)(= var4 4))
    );or
    (progn
    .................
    And, use getint rather than getreal for integers.

    Bob
     
    ECCAD, Jul 27, 2004
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.