Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't compile FSin trig function
#2
(12-28-2020, 01:43 AM)-lpatters Wrote: I'm new to the compiler, using it on Mac OS. Compiling a simple test program works fine. If I paste in the code from the FSin function from the documentation it won't compile:

Code:
../sine.bas:16: error: Syntax Error. Unexpected token 'ELSE' <ELSE>
../sine.bas:17: error: Syntax Error. Unexpected token 'IF' <IF>
../sine.bas:44: error: Syntax Error. Unexpected token 'FUNCTION' <FUNCTION>

I can't understand why the compiler doesn't like this, it looks ok to me. However, I can see an IF without an END IF. This is not how this listing is expressed in the forum post where it was first published. However, adding the missing END IF doesn't appear to help with the compiler errors. What is the problem here?

Thanks for the report! Exclamation

I've fixed it. This has been also updated in the wiki:
https://zxbasic.readthedocs.io/en/docs/library/fsin.bas

That syntax was allowed in legacy version of the compiler where every IF had be closed with END IF. To improve the compatibility with traditional BASIC syntax, a more relaxed form was allowed. So if a sentence follows the THEN or ELSE tokens, the compiler understands it's a single-line IF. So the fix is just breaking the line with after the THEN :-)

Please, try and tell me. Rolleyes
Reply


Messages In This Thread
Can't compile FSin trig function - by patters - 12-28-2020, 01:43 AM
RE: Can't compile FSin trig function - by boriel - 12-28-2020, 09:04 AM
RE: Can't compile FSin trig function - by patters - 12-28-2020, 12:17 PM
RE: Can't compile FSin trig function - by boriel - 12-28-2020, 04:28 PM
RE: Can't compile FSin trig function - by patters - 12-28-2020, 06:05 PM
RE: Can't compile FSin trig function - by boriel - 12-28-2020, 10:58 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)