User Tools

Site Tools


modding:function:and

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
modding:function:and [2017/01/26 00:34] 0xabcdefmodding:function:and [2017/01/27 02:17] (current) 0xabcdef
Line 8: Line 8:
 ^ Arguments | exp1: an expression that evaluates to **Nil** or non-**Nil** | ^ Arguments | exp1: an expression that evaluates to **Nil** or non-**Nil** |
 ^ | [exp2 ... expn]: optional expressions that each evaluate to **Nil** or non-**Nil**. | ^ | [exp2 ... expn]: optional expressions that each evaluate to **Nil** or non-**Nil**. |
-^ Returns | If all arguments return a non-**Nil** value, then returns the value of the last argument. Otherwise, returns **Nil** | +^ Returns | If all arguments return a non-**Nil** value, then returns the value of the last argument. Otherwise, returns **Nil**. If there is only one argument, then returns the value of that argument. 
-^ Category | [[logical operator]] | +^ Category | [[logical operator functions | logical operator]] | 
-^ Description | Uses lazy evaluation, which means that it stops after it finds a **Nil** value or ends up evaluating every argument if all of them return a non-**Nil** value |+^ Description | Uses lazy evaluation, which means that it stops after it finds a **Nil** value or ends up evaluating every argument if all of them return a non-**Nil** value|
  
 === Example === === Example ===
Line 27: Line 27:
 (and (gr (count (setq foo (list Nil Nil Nil))) 2) 5) (and (gr (count (setq foo (list Nil Nil Nil))) 2) 5)
 </code> </code>
-Returns **5**. Also, **foo** will be set to **300**+Returns **5**. Also, **foo** will be set to **(Nil Nil Nil)**
  
 <code> <code>
 (and (setq foo Nil) (setq bar True)) (and (setq foo Nil) (setq bar True))
 </code> </code>
-Returns **Nil**. Also, **foo** will be set to **Nil** and **bar** will not be set to **"baz"**+Returns **Nil**. Also, **foo** will be set to **Nil** and **bar** will not be set to **True**
  
 Return to [[:Functions]] list Return to [[:Functions]] list
  
modding/function/and.1485390873.txt.gz · Last modified: 2017/01/26 00:34 by 0xabcdef