xyproto/battlestar

String concatenation

Immortalin opened this issue · 2 comments

I noticed that in most of the examples for 99bottles, strings are printed separately, variable by variable, is there any way to do string concatenation?

String concatenation is not currently supported, but it's at the top of my list to implement.

Thanks for the suggestion!

It's now possible to concatenate strings. The syntax is a bit wonky, but it works.

Just place var x 1024 somewhere, to declare a variable with 1024 bytes in .bss, then concatenate strings like this:

const hello = "HELLO "
const there = "THERE "
const nl = "\n"
var x 1024 // Must be enough space to append strings

fun main
    x = hello
    x += there
    x += nl
    print(x)
end

Syntactic sugar may be added later.

Cheers!