[metapost] Using |s| as a variable name

Taco Hoekwater taco at elvenkind.com
Wed Dec 5 13:02:26 CET 2007

nicola wrote:
> and why does the following produce an error?
>    string s;
>    s = "aaaaaaa";
>    |s| = length s;
>    for i = 1 upto |s|:
>       ;
>    endfor;

Because the colon is taken to be part of the variable name,
as it is in the same character class as the pipe symbol.

This works:

   for i = 1 upto |s| :

and so does this:

   for i = 1 upto (|s|):

Best wishes,

More information about the metapost mailing list