I know one is an 'if' statement and the other is a conditional statement. but other than that, example A is doing a table search for the text style, but they both are accomplishing the same thing aren't they ??So what is example B doing ??What is the difference ??

... (cond ( (= (strcase tstyl) "ARCHITXT") nil) (command ".-style" "ARCHITXT" "ARCHITXT.SHX" txtht "0.75" "" "n" "n")) ...They are doing the same thing. If you only need to test for one condition, I typically use 'if', if it can have more than to values, I would use 'cond'.

(cond ((= 1 0) none of this will get executed because the conditions is false ) ; end cond 1

((= 1 1) do all of this because it is true and this and this ) ; end cond 2

((= 2 2) none of this will get executed even if it is true because the prior stmt was true ) ; end cond 3

(T This is often placed at the last position in a condition statement and will be executed if all the prior conditions are false if any one of the above conditions are true this will not be executed ) ; end cond 4) ; end cond stmt

The OR will process each line as long as they are false, it will quit when true is returned

(setq var "Some Text")(or var ; Stop here if the var has a value, if nil then keep going (setq var "Some Text"))The AND will process each line as long as they are true, it will quit when false is returned

(and (a. is true) ; keep going (b. do this & if true keep going) (c. do this if b was true))Note that AND & OR themselves only return true or nil,whereas IF and COND will return the value of the expression.

(if (this is true) (progn do all of this and this and this ) (don't do this)); endif

(if (this is false) (don't do this) (progn do all of this and this and this ))So you see the progn is a way to group code together.The (if) stmt will execute the group of code when true andwill execute the second group of code when false,if there is a second group of code. If you forget the (progn) only the firstline of code will be executed if true and the rest skipped.There are other ways to group code together and you will learn them in time.

Outa Gas, I know it's more that you wanted to know.See ya.

The (cond) stmt on the other hand executes all of the code followinga true condition and then exits the condition stmt. Remember true is anything not nil.

(cond ((= 1 0) none of this will get executed because the conditions is false ) ; end cond 1

((= 1 1) do all of this because it is true and this and this ) ; end cond 2

((= 2 2) none of this will get executed even if it is true because the prior stmt was true ) ; end cond 3

(T This is often placed at the last position in a condition statement and will be executed if all the prior conditions are false if any one of the above conditions are true this will not be executed ) ; end cond 4) ; end cond stmt

Here is a trick for the cond statement when you want to conditionally execute the cond.Often we see it like this:

(if (something is true) ; reminder, 'true' here is really anything (not nil) (cond ((= 1 1) ...) ((= 2 2) ...) ) ; end cond stmt) ; endifIt can be written like this so that if something is nottrue the first condition is true &nothing is done but the cond statement is satisfied that it found a true condition. The processing skips the remaining conditions.

The WHILE function as a conditional loop and continues the loop until the next expression returns nil. Here we test the value in cnt looking for it to become 0so that we can exit the while loop. The code within the loop is executed 5 times,while the cnt value is 0 through 4.

(setq continue_loop t)(while (progn ;; do some stuff (not (I want to leave the loop is true)) ; flag to exit the loop ) ; progn)So you see that when (I want to leave the loop is true) returns true, the not willreturn nil and because it is the last expression in the progn, that is the value the while sees. It then exits the loop.

Here is a real world example.This is my solution for entering numbers like key wordsThe simulated key words would be "90 180 270 -90"

Wow !!! Alan, thank you. Yeah, it was a bit more than I was looking for, but then again, I wasn't sure what I was to expect. Definately an opportunity to learn more.Don't take me wrong here, I really do appreciate the info. It explains why a couple of my routines are not acting as they should, I was not completely understanding the conditional, the or & the and statements.I was however, looking for some thought on the tblsearch vs cond. situation. With that info in mind, perhaps I should re-phrase my question.

In the If statement, I am doing a tblsearch for the text style. If it is not available, create it.In the conditional statement, I am NOT doing a tblsearch, but I am doing the same thing, if it is not available, create it.How is this accomplished ??Is the conditional statement recreating the text style regardless, where the If statement is only creating it if it is not there ??

But the = sign is refering to the "ARCHITXT". the nil would be one more parenthesis down. Would the = sign still work for the nil ??My intention for the code would be to find the 'tstyl ARCHITXT', and replace it. Here's the bigger picture.

But the = sign is refering to the "ARCHITXT". the nil would be one more parenthesis down. Would the = sign still work for the nil ??My intention for the code would be to find the 'tstyl ARCHITXT', and replace it. Here's the bigger picture.

the use of (= var nil) or (= (expression) nil) is not needed & most people do it for there readability.The reason it is not needed is that anything that is not nil or returns anything except nil will be considered to be TRUE.Conversely anything that is nil or returns nil will cause the if or cond to pass it by.

Hangman,The cond above is NOT doing the same thing as a table search. It is comparing the variable tstyl to the string "ARCHITXT".You are saying [is the uppercase of variable tstyl equal to the string "ARCHITXT"]

If you want to see if the style is in the drawing use the following code. No need to strcase the variable in the tblsearch as the tblsearch ignores case

It reads like this: If the text style in var tstyl is not in the drawing do the cond

Note that the return value from the cond statement is being saved in the variable txtup

So, the tblsearch does a search of the drawing for the style, period. No variables, no if's, no conditionals, it just does the search.Where the 'if' statement and the 'conditional' statement rely on a variable to do their search. Well, In essence I mean, as the 'if' statement causes the tblsearch to occur.

They are both doing the same thing, but one way is based on given variables where the other is open to suggestion.

Aaaah. I am in understanding. Thank you all for your comments, it has been very enlightening.