Re: Comments between lines raise syntax error
"Ruud H.G. van Tol" <[email protected]> Sat, 15 Nov 2025 13:01:51 +0100
| Newsgroups | gmane.comp.mathematics.pari.user |
|---|---|
| Message-ID | <[email protected]> |
On 2025-11-15 12:49, Ewan Delanoy wrote:
> >I advise to use { ... } for complicated multi-line statements instead
> of a
> >line continuation \. The latter works best for a very small number of
> lines.
>
> On the other hand, if one wishes to separate subinstructions line by
> line for readibility inside a "while" or "if" loop
> inside a function, line continuations are all that's available, right
> ? The error message is "*** sorry, embedded braces (in parser) is
> not yet implemented."
>
>
>
> For example, in the code below I cannot forego the line continuations
> if I wish to avoid the not very readable one-liner
> "example()=if(noMeatToday(),cry();roar(););", right ?
>
> Cheers,
>
> E. D.
>
> noMeatToday()=1
> cry()={}
> roar()={}
>
> example()={
> if(noMeatToday(),\
> cry();\
> roar();\
> );
> }
>
Just one of the many ways:
{ my
( noMeatToday()= 1
, cry()= print("cry")
, roar()= print("roar")
);
example()=
if
( noMeatToday()
, cry()
, roar()
);
}
? example()
cry
Notice that I made the initial 3 functions all lexical.
-- Ruud