Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 11

Multiline string literals for B/S?

I find myself wanting that multiline string literals be supported in BrightScript - instead of manually assembling with `+ chr(10) +`. As simple as:
x = "Hello,

As somebody who's written interpreters i know it's not hard to implement. I imagine there might be concern of missing-quote error rolling down - but note above is now a supported syntax in VB, so such fear is greatly exagerrated ... g-literals

I contemplated Python's:
x = """Hello,
but alas that ship has sailed due to double-quote escape (i.e. tripple-quote """ is ambiguous if it's a literal with 1st char being a quote, or a multi-liner start). Tripling apostrophe may work but doesn't sound very BASIC (singular, it's used as REMark)

There is also Perl-style here-doc (PHP edition):

x = <<<END

There is attractiveness in "heredoc" in that there will be no need to escape quotes (") nor anything else if say including code - just select good marker and copy&paste between. Frankly this seems more and more desirable for my purposes.

Then there is the "cuckoo" operator (qq)... yeah, further alternatives head downhill in attractiveness.
0 Kudos
1 REPLY 1\
Level 10

Re: Multiline string literals for B/S?

I type "naturally", making a new line whenever I want a new line, with each line being an entry of an array. Then a function takes the array and pulls out each line and adds the line break code to build a new array all properly coded. So my front end is almost what you want. Probably you already do something like that though Smiley Wink
0 Kudos