ne: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{MacroFunction | {{MacroFunction | ||
|name=ne | |name=ne | ||
|proposed=false | |proposed=false | ||
|trusted=false | |trusted=false | ||
|description= | |description= | ||
This functions checks for inequality between consecutive parameters. You can use it for string (case-insensitive) or numeric comparisons but not both at the same time. Passing in a mix of strings and numbers will always return {{code|false}}. Any failed comparison (that is: if any two neighboring parameters in the list are equal) and the result will be {{code|false}}. | This functions checks for inequality between consecutive parameters. You can use it for string (case-insensitive) or numeric comparisons but not both at the same time. Passing in a mix of strings and numbers will always return {{code|false}}. Any failed comparison (that is: if any two neighboring parameters in the list are equal) and the result will be {{code|false}}. | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
ne(n1, n2, ...) | ne(n1, n2, ...) | ||
ne(s1, s2, ...) | ne(s1, s2, ...) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|n1+|Number}} | {{param|n1+|Number}} | ||
{{param|s1+|String}} | {{param|s1+|String}} | ||
|example= | |example= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[r: ne(1, 0)] | [r: ne(1, 0)] | ||
[r: ne(0, 1, 2, 3, 3, 4, 5)] | [r: ne(0, 1, 2, 3, 3, 4, 5)] | ||
[r: ne(4, 2, 4)] | [r: ne(4, 2, 4)] | ||
[h: species = "duck"] | [h: species = "duck"] | ||
[r: ne(species, "Duck")] | [r: ne(species, "Duck")] | ||
[r: ne(species, "Chicken")] | [r: ne(species, "Chicken")] | ||
</ | </syntaxhighlight> | ||
'''Returns:''' | '''Returns:''' | ||
< | <syntaxhighlight lang="mtmacro"> | ||
1 | 1 | ||
0 | 0 | ||
1 | 1 | ||
0 | 0 | ||
1 | 1 | ||
</ | </syntaxhighlight> | ||
|also= | |also= | ||
[[equals|equals]] | [[equals|equals]] | ||
}} | }} | ||
[[Category:Macro Function]] | [[Category:Macro Function]] | ||
[[Category:Mathematical Function]] | [[Category:Mathematical Function]] | ||
[[Category:Logical Function]] | [[Category:Logical Function]] | ||
[[Category:String Function]] | [[Category:String Function]] |
Latest revision as of 23:59, 9 February 2023
ne() Function
This functions checks for inequality between consecutive parameters. You can use it for string (case-insensitive) or numeric comparisons but not both at the same time. Passing in a mix of strings and numbers will always return
false
. Any failed comparison (that is: if any two neighboring parameters in the list are equal) and the result will be false
.Usage
ne(n1, n2, ...)
ne(s1, s2, ...)
Parameters
n1+
- Number
s1+
- String
Example
[r: ne(1, 0)]
[r: ne(0, 1, 2, 3, 3, 4, 5)]
[r: ne(4, 2, 4)]
[h: species = "duck"]
[r: ne(species, "Duck")]
[r: ne(species, "Chicken")]
Returns:
1
0
1
0
1