User Tools

Site Tools


modding:function:or

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:or [2017/01/26 00:12] 0xabcdefmodding:function:or [2017/01/26 00:26] (current) 0xabcdef
Line 3: Line 3:
 === or === === or ===
  
-See [[http://xelerus.de/index.php?s=functions&function=135|**or** at Xelerus]]+See [[http://xelerus.de/index.php?s=functions&function=135|or at Xelerus]]
  
 ^ Syntax | (or exp1 [exp2 ... expn]) -> value/Nil | ^ Syntax | (or exp1 [exp2 ... expn]) -> value/Nil |
 ^ Arguments | exp1: An expression that evaluates to **Nil** or something else | ^ Arguments | exp1: An expression that evaluates to **Nil** or something else |
-[exp2 ... expn] | Additional values |+^ [exp2 ... expn] | Additional expressions to be evaluated |
 ^ Category | [[logical operator functions|logical operator]] | ^ Category | [[logical operator functions|logical operator]] |
-^ Returns | The value of the first expression that does not return **Nil**, or **Nil** if there is none +^ Returns | The value of the first expression that does not return **Nil**, or **Nil** if there is none. If there is only one argument, returns the value of that argument. 
-[[modding:function:or]] +^ Description | Uses lazy evaluation, which means that it stops after it finds a non-**Nil** value or ends up evaluating every argument if all of them return **Nil** |
-^ Description | Uses lazy evaluation, which means that it stops after it finds a non-**Nil** argument or ends up evaluating every argument if all of them return **Nil** |+
  
 === Example === === Example ===
Line 17: Line 16:
 (or 1 2 3 4 5 (setq foo 6)) (or 1 2 3 4 5 (setq foo 6))
 </code> </code>
-This will return **1** and foo will not be set to **6**.+Return **1**. Also, foo will not be set to **6**.
  
 <code> <code>
 (or Nil (eq (setq foo "bar") "baz") "qux") (or Nil (eq (setq foo "bar") "baz") "qux")
 </code> </code>
-Returns **"qux"** and **foo** will be set to **"bar"**+Returns **"qux"**. Also, **foo** will be set to **"bar"**
  
 <code> <code>
modding/function/or.1485389539.txt.gz · Last modified: 2017/01/26 00:12 by 0xabcdef