KRBeckman Posted February 5, 2010 Posted February 5, 2010 When creating an if/then senario in lisp's, how do you do consider the expression true for more than one value. Example, I need to ask the user what viewport they want to change, Top, Front, or Right... But I want it to accept "Top" or "T" for Top. Does this work?: (setq vpn (if (= vp (or "Top" "T") (2)) Would "T" or "Top" set vpn as 2? Also, is there a way for me to test on my own? Quote
lpseifert Posted February 5, 2010 Posted February 5, 2010 Try this with T and Top (also F, Front, R, Right) (initget 1 "Top Front Right") (setq ans (getkword "Top, Front or Right")) (cond ((= ans "Top") (setq vpn 2)) ((= ans "Front") (setq vpn 3)) ((= ans "Right") (setq vpn 4)) ) Quote
JohnM Posted February 5, 2010 Posted February 5, 2010 Look at these 2 functions (initget "Abc Def _Ghi Jkl")(getkword "\nEnter an option (Abc/Def): ")Entering A returns Ghi and entering _J returns Jkl. Quote
KRBeckman Posted February 17, 2010 Author Posted February 17, 2010 I got the initget/getkword functions to work for me in this case, but now would I do a if/then that would allow multiple correct inputs, example: if x=(top or bottom), then do a function, else exit program Quote
Lee Mac Posted February 17, 2010 Posted February 17, 2010 I got the initget/getkword functions to work for me in this case, but now would I do a if/then that would allow multiple correct inputs, example: if x=(top or bottom), then do a function, else exit program You could use either the or function, or maybe the member function Quote
KRBeckman Posted February 17, 2010 Author Posted February 17, 2010 lol, I now this is going to sound funny, but I need help on using Visual Lisp's help... I searched for the "or" function and under the concept tab is says: "$(or, val1 [, val2,…, val9])" And I have a couple questions. What's the "$" mean? Why is ",val1,...,val9" in "[]" signs? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.