The sum operator applied to numeric operands performs the standard arithmetic sum, while applied to string operands returns their concatenation:
8
foobar
When applied to a numeric and a string operand, the number is converted into a string:
foo10
The subtraction operator can only be applied to numeric operands; it returns the standard arithmetic subtraction:
18
-10
Unary minus can only be applied to a single numeric operand it returns the same operand with opposite sign.
Assuming variable x
stores the value 5 and variable y
stores the value -5:
-5
5
The multiplication operator, applied to numeric operands, performs the standard arithmetic multiplication:
15
-8
A string multiplied by a number n returns the string repeated n times:
##########
The division operator can only be applied to numeric operands; it returns the standard arithmetic division. Since Cows can only handle integers, results will be truncated.
2
2
The modulus operator can only be applied to numeric operands; it returns the rest of the division of the first operand by the second.
0
1
2
The power operator can only be applied to numeric operands; it returns the first operand raised to the second:
1000
This manual can be downloaded from http://www.g-cows.org/.