From WikiChip
Editing mirc/identifiers/$and
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
This page supports semantic in-text annotations (e.g. "[[Is specified as::World Heritage Site]]") to build structured and queryable content provided by Semantic MediaWiki. For a comprehensive description on how to use annotations or the #ask parser function, please have a look at the getting started, in-text annotation, or inline queries help pages.
Latest revision | Your text | ||
Line 3: | Line 3: | ||
'''Note:''' The numbers need to be provided in decimal, and are then converted to binary, the AND operation applied, and the answer converted back to decimal. | '''Note:''' The numbers need to be provided in decimal, and are then converted to binary, the AND operation applied, and the answer converted back to decimal. | ||
− | |||
== Synopsis == | == Synopsis == | ||
Line 10: | Line 9: | ||
== Parameters == | == Parameters == | ||
* '''<N1>''', '''<N2>''' - The numbers, in decimal | * '''<N1>''', '''<N2>''' - The numbers, in decimal | ||
+ | |||
== Properties == | == Properties == | ||
None | None | ||
Line 23: | Line 23: | ||
The AND operation returns a 1 when both matching binary bits are 1, otherwise returns 0 | The AND operation returns a 1 when both matching binary bits are 1, otherwise returns 0 | ||
− | <source lang="mIRC">//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($and(%n1,%n2),10,2,8) | + | <source lang="mIRC">//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($and(%n1,%n2),10,2,8)</source> |
returns: | returns: | ||
− | 00001110 | + | <pre>00001110 |
00011011 | 00011011 | ||
-------- | -------- | ||
− | 00001010 | + | 00001010</pre> |
$and returns the answer as a decimal number, so the answer 10 is the decimal representation of binary 1010. | $and returns the answer as a decimal number, so the answer 10 is the decimal representation of binary 1010. | ||
− | |||
− | |||
− | |||
− | |||
== Compatibility == | == Compatibility == | ||
{{mIRC compatibility|5.61}} | {{mIRC compatibility|5.61}} | ||
+ | |||
== See also == | == See also == | ||
* {{mIRC|$not}} | * {{mIRC|$not}} | ||
Line 45: | Line 42: | ||
* {{mIRC|$bitoff}} | * {{mIRC|$bitoff}} | ||
* {{mIRC|$isbit}} | * {{mIRC|$isbit}} | ||
+ | * [[List of identifiers - mIRC]] | ||
+ | {{mIRC identifier list}} | ||
+ | [[Category:mIRC identifiers|and]] |