Multiline stings

Most other scripting languages offer some kind of multi-line string support. The general term for this is "here document", see:

I thought this would be a nice feature to add to SmallBASIC. I decided I liked the Python syntax style and this turned out to be fairly straight forward to implement. A multi-line string is declared by enclosing it in triple quotes (double quotes only). The syntax looks like this:

s1= """

If you call PRINT s1, the output includes new line characters. These can be excluded by escaping the line end character, like this:

s1= """\

As part of this change, a single string may also be created from multiple quoted strings on separate lines, like this:


This should make it easier for example to embed XPM bitmap images.

The multiline string does look like a nice addition!

This is so far a display facility, without the other 'over-loading' of Here Document?


SB if finds the & at the end of the line then it adds the next line.

a = &
"1234" + &
? a

This prints


I would prefer (in preprocessor stage) something like

s = &<
line 1
line n

&" and &", it would be nice too.
I select the '&' since it is already used in SB.

chris, youre doing more great stuff.

multiline strings are one of the things in python that really impressed me.