Operators

Comparisons

Wrival Operators
Wrival will process arithmetic inline on number formats including whole numbers, decimals, fractions, and percentages. A space on the left and right of the operators are required. Any values in quotes will prevent an operation from being evaluated. Also, parenthesis will also be prioritized as expected.
<#power2 = 2>
<#rem10 = 10>
<#hundred = 100>
<#pairs = "five=5,ten=10">
Type  Description  Example  Result 

++ 
Increment and assign.  <#hundred++> 
101 
 
Decrement and assign.  <#hundred> 
100 
** 
Power of.  <#2 ** 4> 
16 
% 
Remainder of division.  <#10 % 7> 
3 
/ 
Divide numbers.  <#hundred / 5> 
20 
* 
Multiply numbers.  <#hundred * 5> 
500 
+ 
Add numbers.  <#hundred + 5> 
105 
Combine strings if not numbers.  <#hundred + "lb"> 
100lb  
 
Subtract numbers.  <#hundred  5> 
95 
= 
Assign a value to an object.  <#test = 100> 
100 
**= 
Power of and assign an object.  <#power2 **= 4> 
16 
%= 
Remainder of division.  <#rem10 %= 7> 
3 
/= 
Divide and assign an object.  <#test /= 5> 
20 
*= 
Multiply and assign an object.  <#test *= 2> 
40 
+= 
Add and assign an object.  <#test += 60> 
100 
= 
Subtract and assign an object.  <#test = 30> 
70 
() 
Process parenthesis first.  <#2 * (3 + 4)> 
14 
Wrival Comparisons
Comparisons within embedded objects and will return "True" or "False" depending on the result of the evaluation.
<#ten = 10>
<#five = 5>
<#fifty = 50>
<#W = "Wrival">
Type  Description  Example  Result 

== 
True if the values have the same numerical value.  <#ten == five> 
False 
!= 
True if the values do not have the same numerical value.  <#ten != five> 
True 
< 
True if the left value is less than the right value.  <#ten < five> 
False 
<= 
True if the left value is less than or equal to the right value.  <#ten <= five> 
False 
> 
True if the left value is greater than the right value.  <#ten > five> 
True 
>= 
True if the left value is greater than ot equal to the right value.  <#ten >= five> 
True 
<=> 
Returns 1 if greater than, 0 if equal, or 1 if less than.  <#ten <=> five> 
1 
eq 
True if the values are the same.  <#ten eq five> 
False 
ne 
True if the values are not the same.  <#ten ne five> 
True 
=~ 
True if the latter value matches the first value.  <#fifty =~ five> 
True 
=~ ^ 
True if the latter value matches the start of the first value.  <#fifty =~ ^five> 
True 
=~ $ 
True if the latter value matches the end of the first value.  <#fifty =~ five$> 
False 
!~ 
True if the latter value doesn't match the first value.  <#fifty !~ five> 
False 
!~ ^ 
True if the latter value doesn't match the start of the first value.  <#fifty !~ ^five> 
False 
!~ $ 
True if the latter value doesn't match the end of the first value.  <#fifty !~ five$> 
True 
&& 
True if both value resolve to True.  <#ten > five && fifty > five> 
True 
 
True if either value resolves to True.  <#ten < five  fifty > five> 
True 
and 
An alias of &&.  <#ten > five AND fifty > five> 
True 
or 
An alias of .  <#ten < five OR fifty > five> 
True 
(~)gi 
Match and replace, g=global (all matches), i=case insensitive.  <#W("i"~"_")gi> 
Wr_val 
? ! 
If ? True ! False.  <#ten > five ? "Yes" ! "No"> 
Yes 
! 
Return the first value if its not nothing otherwise return the alternative value.  <#nothing ! "Alt"> 
Alt 
! 
Return the first value if its not nothing otherwise return the alternative value.  <#ten ! "Alt"> 
10 
! 
Return the first value if its not nothing otherwise return the alternative value.  <#"something" ! "Alt"> 
something 
! 
Return the first value if its not nothing otherwise return the alternative value.  <#"<#ten>" ! "Alt"> 
10 
Switch Behaviors
<#nothing ! 1 == 1 ? "Finally a value." ! "False">
<#nothing ! stillnodda ! "something">
<#nothing ! date ! "else">
Result:
Finally a value.
something
December 17, 2017