From the course: Learning AutoLISP & Visual LISP
Unlock the full course today
Join today to access over 22,700 courses taught by industry experts or purchase this course individually.
Function: subst - AutoCAD Tutorial
From the course: Learning AutoLISP & Visual LISP
Function: subst
- [Instructor] Another useful list editing function. It allows you to substitute one value for another in the list. So we have our list here, LIST8. Let's confirm that the variable is set to this value, 10 through 15, and let's substitute using the function SUBST, representing substitute, the value, 20 wherever you see 12 in the list. Of course, provide the list to that we're searching, and so there's three arguments we just provided to the substitute function. The first argument, the value that's going to be new that is going to be used as the substitute. The second argument, the value that's going to be substituted, is going to be replaced, and then the list as the third argument. So the result, notice 10, 11, 12 has been replaced with 20 in our list.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.