Use line continuation (_) or correct indentation (see last item)
if 1 > 0 then output("positive") else output("nonpositive")
if 1 > 0 then output("positive") _
else output("nonpositive")
if 1 > 0 then output("positive") _
else output("nonpositive")
if 1 > 0 _
then output("positive") _
else output("nonpositive") _
if 1 > 0 _
then output("positive") _
else output("nonpositive")
if 1 > 0 then
output("positive") else
output("nonpositive")
--
if 1 > 0 then output("positive") else output("nonpositive")
positive
Type:
Void
if 1 > 0 then output("positive") _
else output("nonpositive")
positive
Type:
Void
if 1 > 0 then output("positive") _
else output("nonpositive")
positive
Type:
Void
if 1 > 0 _
then output("positive") _
else output("nonpositive") _
positive
Type:
Void
if 1 > 0 _
then output("positive") _
else output("nonpositive")
positive
Type:
Void
if 1 > 0 then
output("positive") else
output("nonpositive")
positive
Type:
Void
(12) ->
On Saturday, 4 January 2025 at 19:08:08 UTC+1 Sid Andal wrote:
> The file test.input contains the following lines from the manual
> on acceptable (indented) if-then-else expressions:
>
> cat test.input:
>
> if 1 > 0 then output("positive") else output("nonpositive")
>
> if 1 > 0 then output("positive")
> else output("nonpositive")
>
> if 1 > 0 then output("positive")
> else output("nonpositive")
>
> if 1 > 0
> then output("positive")
> else output("nonpositive")
>
> if i > 0
> then output("positive")
> else output("nonpositive")
>
>
> Except for the first one-liner, the remaining ones give syntax errors:
>
>
> (1) -> )r test
> if 1 > 0 then output("positive") else output("nonpositive")
>
> positive
>
> if 1 > 0 then output("positive")
>
> positive
> else output("nonpositive")
>
> Line 4: else output("nonpositive")
> A
> Error A: Improper syntax.
> 1 error(s) parsing
>
> Continuing to read the file...
>
>
> if 1 > 0 then output("positive")
>
> positive
> else output("nonpositive")
>
> Line 7: else output("nonpositive")
> A
> Error A: Improper syntax.
> 1 error(s) parsing
>
> Continuing to read the file...
>
>
> if 1 > 0
>
> Line 8:
> Line 9: if 1 > 0
> .......A
> Error A: syntax error at top level
> Error A: Possibly missing a then
> 2 error(s) parsing
>
> Continuing to read the file...
>
> then output("positive")
>
> Line 10: then output("positive")
> A
> Error A: Improper syntax.
> 1 error(s) parsing
>
> Continuing to read the file...
>
> else output("nonpositive")
>
> Line 11: else output("nonpositive")
> A
> Error A: Improper syntax.
> 1 error(s) parsing
>
> Continuing to read the file...
>
>
> if 1 > 0
>
> Line 12:
> Line 13: if 1 > 0
> .......A
> Error A: syntax error at top level
> Error A: Possibly missing a then
> 2 error(s) parsing
>
> Continuing to read the file...
>
> then output("positive")
>
> Line 14: then output("positive")
> A
> Error A: Improper syntax.
> 1 error(s) parsing
>
> Continuing to read the file...
>
> else output("nonpositive")
>
> Line 15: else output("nonpositive")
> A
> Error A: Improper syntax.
> 1 error(s) parsing
>
> Continuing to read the file...
>
> (4) ->
>
> Thanks,
> SWA
>
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/fricas-devel/0076bc2c-d28d-4923-a8e5-7ea54db7ecafn%40googlegroups.com.