So I'm trying to make it so a link goes to a specific passage. The player is on passage 8 and they want to go to passage 9, but in this circumstance I need to write 9 in relation to the current passage.
So I tried using:
[[Up|passage()+1]]
and it sends me to passage 81 instead of 9.
I tried it with a minus code:
[[Down|passage()-1]]
and it worked fine (took me to passage 7), the same with divide and multiply but not plus.
Comments
The reason the first doesn't work as you wanted, while the second does is because the plus sign (+) is both the arithmetic addition operator and the string concatenation operator.
Your first example actually looks like the following to the system: Since the first operand is a string, the system decides that plus sign should be the string concatenation operator: Which results in the number being converted to a string:
Your second example goes something like the following: Since the minus sign may only be the arithmetic subtraction operator in this instance, the system decides to convert the string into a number:
TL;DR: Passage names are strings. Don't combine strings and numbers unless you are aware of the consequences.
If you simply have to do arithmetic with passage names, then you'll need to forcibly convert the passage names to numbers. You may do so like the following: You could also do something like the following, but it's a bit wordier: Obviously, you should only do either of those for passage names which consist solely of numerals.