c64commodore

How to print quotes inside quotes but in commodore 64 basic v.2.0


I'm writing a little hobby c64 textual adventure and I've stopped in one very concrete moment. Namely, I don't know how to quote anything inside quote.

How to do that inside commodore 64 basic v.2.0.?


Solution

  • You have to generate a string containing the quote character some other way than as a literal. The obvious way is to use CHR$, as in:

    ? "ONE ";CHR$(34);"QUOTED";CHR$(34);" WORD"
    

    One of the examples at http://www.c64-wiki.com/index.php/CHR%24 is quite similar to this.

    If you have to do a lot of them, you could store it in a variable to make the code shorter (which may make it faster or slower - if this matters, measure it yourself)

    10 QU$ = CHR$(34)
    20 ? "ONE ";QU$;"QUOTED";QU$;" WORD"