The following example shows the use of local variables in a user-defined function (be certain there is at least one space between the slash and the local variables).
_$β(defun LOCAL ( / aaa bbb)
(_>β(setq aaa "A" bbb "B")
(_>β(princ (strcat "\naaa has the value " aaa ))
(_>β(princ (strcat "\nbbb has the value " bbb))
(_>β(princ) )
LOCAL
aaa and bbb to values other than those used in the LOCAL function.
Before you test the new function, assign variables_$β(setq aaa 1 bbb 2)
2
aaa and bbb are actually set to those values.
You can verify that the variables_$βaaa
1
_$βbbb
2
LOCAL function.
Now test the_$β(local)
aaa has the value A
bbb has the value B
aaa and bbb that are local to the function. You can verify that the current values for aaa and bbb are still set to their nonlocal values.
You will notice the function used the values for_$βaaa
1
_$βbbb
2
In addition to ensuring that variables are local to a particular function, this technique also ensures the memory used for those variables is available for other functions.