# Twine Wiki

harlowe:number

### Number data

Number data is just numbers, which you can perform basic mathematical calculations with. You'll generally use numbers to keep track of statistics for characters, count how many times an event has occurred, and numerous other uses.

You can do all the basic mathematical operations you'd expect to numbers: `(1 + 2) / 0.25 + (3 + 2) * 0.2` evaluates to the number 13. The computer follows the normal order of operations in mathematics: first multiplying and dividing, then adding and subtracting. You can group subexpressions together and force them to be evaluated first with parentheses.

If you're not familiar with some of those symbols, here's a review, along with various other operations you can perform.

Operator Meaning Example
`+` Addition. `5 + 5` (is 10)
`-` Subtraction. Can also be used to negate a number. `5 - -5` (is 10)
`*` Multiplication. `5 * 5` (is 25)
`/` Division. `5 / 5` (is 1)
`%` Modulo (remainder of a division). `5 % 26` (is 1)
`>` Evaluates to boolean `true` if the left side is greater than the right side, otherwise `false`. `\$money > 3.75`
`>=` Evaluates to boolean `true` if the left side is greater than or equal to the right side, otherwise `false`. `\$apples >= \$carrots + 5`
`<` Evaluates to boolean `true` if the left side is less than the right side, otherwise `false`. `\$shoes < \$people * 2`
`<=` Evaluates to boolean `true` if the left side is less than or equal to the right side, otherwise `false`. `65 <= \$age`
`is` Evaluates to boolean `true` if both sides are equal, otherwise `false`. `\$agendaPoints is 2`
`is not` Evaluates to boolean `true` if both sides are not equal, otherwise `false`. `\$agendaPoints is not 0`
`matches` Evaluates to boolean `true` if one side is a number and the other is an identical number or `num` or `number` `\$bytes matches \$dataUsage`
`is a`, `is an` Evaluates to boolean `true` if the right side is `num` or `number` and the left side is a number. `\$credits is a num`

You can only perform these operations (apart from `is`) on two pieces of data if they're both numbers. Adding the string “5” to the number 2 would produce an error, and not the number 7 nor the string “52”. You must convert one side or the other using the (num:) or (text:) macros. 