equals: Difference between revisions
Jump to navigation
Jump to search
(Created page with "{{MacroFunction |name=equals |proposed=false |trusted=false |description= This functions checks for equality between all of the passed in values. You can use it for string (c...") |
No edit summary |
||
(5 intermediate revisions by 4 users not shown) | |||
Line 7: | Line 7: | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
equals(n1, n2, ...) | equals(n1, n2, ...) | ||
equals(s1, s2, ...) | equals(s1, s2, ...) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|n1+|Number}} | {{param|n1+|Number}} | ||
Line 16: | Line 16: | ||
|example= | |example= | ||
<syntaxhighlight lang="mtmacro" line> | |||
< | |||
[r: equals(1, 1)] | [r: equals(1, 1)] | ||
[r: equals(1, 1, 0)] | [r: equals(1, 1, 0)] | ||
Line 23: | Line 22: | ||
[r: equals(species, "Duck")] | [r: equals(species, "Duck")] | ||
[r: equals(species, "Chicken")] | [r: equals(species, "Chicken")] | ||
</ | </syntaxhighlight> | ||
'''Returns:''' | '''Returns:''' | ||
< | <syntaxhighlight lang="mtmacro"> | ||
1 | 1 | ||
0 | 0 | ||
1 | 1 | ||
0 | 0 | ||
</ | </syntaxhighlight> | ||
|also= | |also= | ||
Line 38: | Line 37: | ||
[[Category:Macro Function]] | [[Category:Macro Function]] | ||
[[Category:Mathematical Function]] | [[Category:Mathematical Function]] | ||
[[Category:Logical Function]] | |||
[[Category:String Function]] | [[Category:String Function]] |
Latest revision as of 23:59, 14 March 2023
equals() Function
This functions checks for equality between all of the passed in values. 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
.Usage
equals(n1, n2, ...)
equals(s1, s2, ...)
Parameters
n1+
- Numbers1+
- String
Example
[r: equals(1, 1)]
[r: equals(1, 1, 0)]
[h: species = "duck"]
[r: equals(species, "Duck")]
[r: equals(species, "Chicken")]
Returns:
1
0
1
0