Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Undocumented continuation line syntax?
#2
Felix Wrote:Hello, everyone! First time poster here.
Welcome to the forum, Felix, and sorry for the delay (I'm currently wokring in hard deadlines :oopsSmile, but the forum has many active users, anyway. 8)

Felix Wrote:While working on my second ZXBasic game, I accidentally discovered a syntax feature I can't seem to find documented anywhere.

Namely, a backslash at the end of a line causes it to be concatenated with the next one. That also works inside a comment, in which case the next line is "eaten up". That's more or less like in C, if I remember correctly, but in ZXBasic it surprised me because the wiki only mentions the underscore as a continuation line.

Is there anything I missed?
Well, the FreeBasic / Visual BASIC "standar" (ahem...) uses underscore. But ZX BASIC also uses a C-like preprocessor. This means the source code is firstly filtered through a C-Like preprocessor (CPP), called zxbpp, and then the resulting code is compiled. The C preprocessor allows backslash as a continuation line, so any line you write backslashed will be joined or translated to underscore (depending on the context).
So yes, ZX Basic allows both _ and \ as line continuation characters, but \ is not documented because it should be in the preprocessor section (... which is not documented yet! :?)
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)