Bug in IF ELSE construct?

Post Reply
User avatar
Dutchman
Posts: 151
Joined: Tue Aug 06, 2019 4:47 pm
Location: Netherlands

Bug in IF ELSE construct?

Post by Dutchman » Sun Sep 15, 2019 11:44 am

The following code gave syntax error, WHY?
IF mode THEN DRAW COLOR HSV2RGB|3 (ang 1 t/runtime)\
ELSE DRAW COLOR HSV2RGB|3(5*t/runtime*360 0.8 1)
It is still a long way to go

User avatar
kibernetik
Site Admin
Posts: 143
Joined: Tue Aug 06, 2019 3:03 pm

Re: Bug in IF ELSE construct?

Post by kibernetik » Sun Sep 15, 2019 11:48 am

In multiline IF there should be nothing after THEN and ELSE.

Also, your syntax is not correst:

Code: Select all

IF mode THEN : DRAW COLOR HSV2RGB|3 (ang 1 t/runtime) ELSE DRAW COLOR HSV2RGB|3(5*t/runtime*360 0.8 1) 
it should look like:

Code: Select all

IF mode THEN
  DRAW COLOR HSV2RGB|3 (ang 1 t/runtime)
ELSE
  DRAW COLOR HSV2RGB|3(5*t/runtime*360 0.8 1)
ENDIF 
Of course you can merge lines using ':' separator.

User avatar
Dutchman
Posts: 151
Joined: Tue Aug 06, 2019 4:47 pm
Location: Netherlands

Re: Bug in IF ELSE construct?

Post by Dutchman » Thu Sep 19, 2019 10:04 am

IF I write the problem in a single line as in my first post without "\":
IF mode THEN DRAW COLOR HSV2RGB|3 (ang 1 t/runtime) ELSE DRAW COLOR HSV2RGB|3(5*t/runtime*360 0.8 1)
then I get "Syntax error". Version 1.1.1

Note: I had corrected the ":" in my first post before you gave your answer.
It is still a long way to go

User avatar
kibernetik
Site Admin
Posts: 143
Joined: Tue Aug 06, 2019 3:03 pm

Re: Bug in IF ELSE construct?

Post by kibernetik » Thu Sep 19, 2019 10:55 am

Yes, this is a bug.
Thank you for information.

Currently you can workaround it by writing DRAWCOLOR as a single word.

User avatar
Dutchman
Posts: 151
Joined: Tue Aug 06, 2019 4:47 pm
Location: Netherlands

Re: Bug in IF ELSE construct?

Post by Dutchman » Thu Sep 19, 2019 12:19 pm

kibernetik wrote:
Thu Sep 19, 2019 10:55 am

Currently you can workaround it by writing DRAWCOLOR as a single word.
That is easy :D
It is still a long way to go

User avatar
kibernetik
Site Admin
Posts: 143
Joined: Tue Aug 06, 2019 3:03 pm

Re: Bug in IF ELSE construct?

Post by kibernetik » Thu Sep 19, 2019 12:36 pm

This will be fixed in next release.

Post Reply