Author Topic: Syntax of a Conditional  (Read 7103 times)

0 Members and 1 Guest are viewing this topic.

Sdoman

  • Guest
Re: Syntax of a Conditional
« Reply #15 on: April 18, 2006, 12:31:41 AM »
Code: [Select]
(cond (getvar 'snapisopair)
       (1 (setvar 'snapisopair 2))
       (2 (setvar 'snapisopair 0))
       (0 (setvar 'snapisopair 1)) )

When I run the code above it returns 'snapisopair, and leaves the value of snapisopair unchanged.  :?  I must be missing something...


 

Jürg Menzi

  • Swamp Rat
  • Posts: 599
  • Oberegg, Switzerland
Re: Syntax of a Conditional
« Reply #16 on: April 18, 2006, 02:58:52 AM »
Code: [Select]
(cond (getvar 'snapisopair)
       (1 (setvar 'snapisopair 2))
       (2 (setvar 'snapisopair 0))
       (0 (setvar 'snapisopair 1)) )

When I run the code above it returns 'snapisopair, and leaves the value of snapisopair unchanged.  :?  I must be missing something... 
Hummmm... case? :roll:
A computer's human touch is its unscrupulousness!
MENZI ENGINEERING GmbH
Current A2k16... A2k24 - Start R2.18

JohnK

  • Administrator
  • Seagull
  • Posts: 10659
Re: Syntax of a Conditional
« Reply #17 on: April 18, 2006, 07:25:50 AM »
Here 'ya go John ...

< insert comment about where you were when this was written >
...

Holly cow!? Jackpot! ...Umm, I would have been in Junior high.

No kidding, i was trying to build a LET yesterday.

Kerry, are you sure you arnt working in my office, cause it seems like you always do this to me; You always seem to know what im doing/thinking/etc.  ...Are you some sort of evil genius?
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Sdoman

  • Guest
Re: Syntax of a Conditional
« Reply #18 on: April 18, 2006, 08:00:40 AM »
Hummmm... case? :roll:

OK, I get it know.  I was assuming that in the original code Se7en had posted that he stumbled across some side effect of the Cond function which allowed it to work as a Case function and it actually worked.  That's how I read it.  Apparently it went over my head.   :-)

Anyhow, I like this one from MP:

Code: [Select]
(setvar "snapisopair"
    (nth
        (getvar "snapisopair")               
       '(1 2 0)
    )
)