Welcome
The $and identifier will return the result from a bitwise "and".
[edit]
Format
$and(<value1>,<value2>)
[edit]
Parameters
- <value1> One of the two values you want to do a bitwise and between.
- <value2> The other value.
[edit]
Properties
None.
[edit]
Points To Note
The identifier doesn't take binary values as parameters, only decimal numbers.
[edit]
Examples
//echo -a $and(4,1)
Output: 0
| 4 | 1 | 0 | 0 |
|---|---|---|---|
| 1 | 0 | 0 | 1 |
| 0 | 0 | 0 | 0 |
//echo -a $and(4,7)
Output: 4
| 4 | 1 | 0 | 0 |
|---|---|---|---|
| 7 | 1 | 1 | 1 |
| 4 | 1 | 0 | 0 |
//echo -a $and(9,11)
Output: 9
| 9 | 1 | 0 | 0 | 1 |
|---|---|---|---|---|
| 11 | 1 | 0 | 1 | 1 |
| 9 | 1 | 0 | 0 | 1 |
[edit]
Hacks
You can combine $and and $not to make "nand".
$not($and(4,7))
You can leave the first parameter of $and empty and use an identifier in the second parameter to force the identifier to evaluate but not return a value. This is useful for $regex and $com
//echo -a $and(,$regex(abc,/a(.)c/)) * $regml(1)
[edit]
Related Articles
None.
[edit]
Related Commands
None.
[edit]
Related Events
None.
[edit]
Related Identifiers
$not $or $xor $base $biton $bitoff $isbit
| Text and Number Identifiers |
|---|
| $abs • $acos • $and • $asc • $asin • $atan • $base • $biton • $bitoff • $bytes • $calc • $ceil • $chr • $compress • $cos • $count • $decode • $decompress • $encode • $floor • $int • $isbit • $islower • $isupper • $left • $len • $log • $longip • $lower • $mid • $noqt • $not • $or • $ord • $pos • $poscs • $qt • $rand • $remove • $removecs • $replace • $replacecs • $replacex • $replacexcs • $right • $round • $sin • $sqrt • $str • $strip • $stripped • $tan • $upper • $wrap • $xor |