Coercing a string to an integer in GolfScript GolfScript automatically coerces values, according to the following ‘priority’ sequence:


  integer → array → string → block


(listed from lowest to highest.)

This means that "1"7+ leaves the string "17" on the stack (and not 8), because strings have a higher priority than integers.

[To those GolfScript veterans – apologies for insulting your respective intelligences.]

How would it be possible to do this the other way? That is, to coerce a string into an integer?
There's an operator ~ in golfscript, which does the following: bitwise not, dump, eval.

Therefore, "1" will give the string "1" while "1"~ will evaluate that string (into the integer 1).

Then, all you need to do is "1"~7+.

Try it online!