User:松/Drafts/Extension:AbuseFilter/Rules format: Difference between revisions

m
no edit summary
(→‎Order of operations: Translation code removal.)
mNo edit summary
Line 72:
You can use basic arithmetic symbols to do arithmetic on variables and literals with the following syntax:
 
* <code>-</code> — Subtract the right-hand operand from the left-hand operand.
* <code>+</code> — Add the right-hand operand to the left-hand operand.
* <code>*</code> — Multiply the left-hand operand by the right-hand operand.
* <code>/</code> — Divide the left-hand operand by the right-hand operand.
* <code>**</code> — Raise the left-hand operand to the exponential power specified by the right-hand operand.
* <code>%</code> — Return the remainder given when the left-hand operand is divided by the right-hand operand.
 
The type of the returned result is the same that would be returned by PHP, for which a lot of documentation may be found [https://php.net/language.operators.arithmetic online].
Line 103:
You can match if and only if all of a number of conditions are true, one of a number of conditions are true, or one and only one of all conditions are true.
 
* <code>x | y</code> &mdash; OR &ndash; returns true if one or more of the conditions is true.
* <code>x & y</code> &mdash; AND &ndash; returns true if both of the conditions are true.
* <code>x ^ y</code> &mdash; XOR &ndash; returns true if one, and only one of the two conditions is true.
* <code>!x</code> &mdash; NOT &ndash; returns true if the condition is not true.
 
'''Examples'''
Line 156:
You can compare [[w:Variable (computer science)|variables]] with other variables and [[w:Operand|literals]] with the following [[w:syntax|syntax]]:
 
* <code>&lt;</code>{{int|comma-separator}}<code>&gt;</code> &mdash; Return true if the left-hand [[w:Operand|operand]] is ''less than/greater than'' the right-hand operand respectively. Watch out: operands are casted to strings and, like it happens in PHP, <code>null < any number === true</code> and <code>null > any number === false</code>.
* <code>&lt;=</code>{{int|comma-separator}}<code>&gt;=</code> &mdash; Return true if the left-hand operand is ''less than or equal to/greater than or equal to'' the right-hand operand respectively.Watch out: operands are casted to strings and, like it happens in PHP, <code>null <= any number === true</code> and <code>null >= any number === false</code>.
* <code>==</code> (or<code>=</code>), <code>!=</code> &mdash; Return true if the left-hand operand is ''equal to/not equal to'' the right-hand operand respectively.
* <code>===</code>{{int|comma-separator}}<code>!==</code> &mdash; Return true if the left-hand operand is ''equal to/not equal to'' the right-hand operand AND the left-hand operand is ''the same/not the same'' data type to the right-hand operand respectively.
<!--Note: these examples are also used in https://phabricator.wikimedia.org/diffusion/EABF/browse/master/tests/parserTests/mwexamples-comparisons.t -->
 
222

edits