Bill Allombert on Sat, 01 Nov 2025 11:47:27 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Comments between lines raise syntax error


On Sat, Nov 01, 2025 at 10:03:42AM +0100, Ewan Delanoy wrote:
> I have an a small array which I prefer to write line by line for readability,
> and I also would like to insert a few comments in-between some lines.
> 
> The following naive trial raises a syntax error in PARI-GP. How can I modify it a little bit to turn it into valid syntax ?

Use braces:

level4={[
e4,
/* Level 1 multiplied by Level 3 */
z1*z5,
z1*z6,
z1*z7,
/* Level 2 multiplied by itself */
z2*z2,
z2*z3,
z3*z3
]}

If you want to use \ instead, you need to add it at the end of every lines,
including comment lines and empty lines.

level4=([\
e4,\
/* Level 1 multiplied by Level 3 */\
z1*z5,\
z1*z6,\
z1*z7,\
/* Level 2 multiplied by itself */\
z2*z2,\
z2*z3,\
z3*z3\
])

Cheers,
Bill.