(setq symbol1 statement1 [symbol2 statement2] ...)
Set the symbol to the statement.
This function is LISP's most commonly-used assignment function. This function assigns statement1 to symbol1. For example:
(setq x 16)
sets the value of 16 to the symbol x.
NOTE Don't confuse this with the equals function (=. The = function doesn't assign.
Symbol1 is the variable that receives the value, where as statement1 is the value that is assigned to symbol1. Statement1 can be a variable representing a value, a numeric value, or a string.
Examples
| Code | Returns | 
|---|---|
| (setq y 10) | 10 | 
| (setq x y) | 10 Sets the variable x to the value of y-previously we set y to 10. | 
| (setq myvar "Mom") | "Mom" | 
| (setq pt1 '(5 3)) | (5 3) | 
NOTE You can set multiple variables at a time with the setq function. The [symbol2 stmt2]... is optional. When assigning multiple variables, the value returned is the last variable's assigned value.
| Code | Returns | 
|---|---|
| (setq a 5 b 6) | 6 | 
| (setq x 1.0y 2.0 z 3.0) | 3.0 | 
To see the value of any variable, type ! before the variable name:
| Code | Returns | 
|---|---|
| !a | 5 | 
| !b | 6 | 
Tell me about...
(defun [c:] name ([arg1 arg2 ...] / [local-var1 local-var2 ...]) expression)
 
                         en
  en italiano
 italiano čeština
 čeština Deutsch
 Deutsch français
 français hrvatski
 hrvatski magyar
 magyar polski
 polski српски
 српски русский
 русский 中文
 中文 中文
 中文 한국어
 한국어 español
 español