From WikiChip
Difference between revisions of "mirc/identifiers/$and"
m |
m |
||
Line 1: | Line 1: | ||
− | {{mirc title|$and | + | {{mirc title|$and identifier}}'''$and''' returns the AND operation of the two numbers, the numbers are decimal not binary. |
== Synopsis == | == Synopsis == | ||
− | <pre>$addtok(< | + | <pre>$addtok(<N1>,<N2>)</pre> |
− | == | + | == Parameters == |
− | * '''< | + | * '''<N1>''', '''<N2>''' - The numbers |
− | |||
== Properties == | == Properties == | ||
Line 14: | Line 13: | ||
== Example == | == Example == | ||
− | <source lang="mIRC">//echo -a $ | + | <source lang="mIRC">//echo -a $or(14,27) |
− | ; returns | + | ; returns 31 |
</source> | </source> | ||
− | + | Bits which are both 0 return 0, otherwise the bit is 1 | |
− | <pre>//var %n1 14 | var %n2 27 | echo -a $base(%n1,10,2,8) | echo -a $base(%n2,10,2,8) | echo -a $str(-,8) | echo -a $base($ | + | <pre>//var %n1 14 | var %n2 27 | echo -a $base(%n1,10,2,8) | echo -a $base(%n2,10,2,8) | echo -a $str(-,8) | echo -a $base($or(%n1,%n2),10,2,8) |
; returns: | ; returns: | ||
00001110 | 00001110 | ||
00011011 | 00011011 | ||
-------- | -------- | ||
− | + | 00011111 | |
− | $ | + | $or returns the answer as a decimal number, so the answer 31 is the decimal representation of binary 11111. |
</pre> | </pre> | ||
Line 34: | Line 33: | ||
== See Also == | == See Also == | ||
− | {{mIRC|$not}} | + | * {{mIRC|$not}} |
− | {{mIRC|$or}} | + | * {{mIRC|$or}} |
− | {{mIRC|$xor}} | + | * {{mIRC|$xor}} |
− | {{mIRC|$biton}} | + | * {{mIRC|$biton}} |
− | {{mIRC|$bitoff}} | + | * {{mIRC|$bitoff}} |
− | {{mIRC|$isbit}} | + | * {{mIRC|$isbit}} |
− | + | * [[List of identifiers - mIRC]] | |
− | + | {{mIRC identifier list}} | |
[[Category:mIRC identifiers|and]] | [[Category:mIRC identifiers|and]] |
Revision as of 06:54, 21 September 2017
Commands & Identifiers
Basics
Events
Matching Tools
Data Storage
Control Structures
GUI Scripting
Sockets
Advanced Scripting
Additional Resources
Security
Other
$and returns the AND operation of the two numbers, the numbers are decimal not binary.
Synopsis
$addtok(<N1>,<N2>)
Parameters
- <N1>, <N2> - The numbers
Properties
None
Example
//echo -a $or(14,27) ; returns 31
Bits which are both 0 return 0, otherwise the bit is 1
//var %n1 14 | var %n2 27 | echo -a $base(%n1,10,2,8) | echo -a $base(%n2,10,2,8) | echo -a $str(-,8) | echo -a $base($or(%n1,%n2),10,2,8) ; returns: 00001110 00011011 -------- 00011111 $or returns the answer as a decimal number, so the answer 31 is the decimal representation of binary 11111.
Compatibility
Added: mIRC v5.61
Added on: 23 Sep 1999
Note: Unless otherwise stated, this was the date of original functionality.
Further enhancements may have been made in later versions.
See Also
mIRC identifier list