Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
evilmax17
Visitor

Code that spans multiple lines?

Does BrightScript support something like the following syntax format?


result = myFunction( "Parameter 1",
"Parameter 2",
"Parameter 3" )

I've tried a few different things, and I can't get it to compile unless it's all on one line.

Thanks!
My Roku Channels:
Viddler - viddler.com
Tested Fan - tested.com | Jamie & Adam
This is my next - theverge.com
1080p Showcase - RIP
Whiskey Media - RIP
======================
http://www.binarymoustache.com
0 Kudos
3 REPLIES 3
destruk
Binge Watcher

Re: Code that spans multiple lines?

The sdk makes this work with something similar to
result = myFunction( {"Parameter 1",
"Parameter 2",
"Parameter 3"} )
0 Kudos
kbenson
Visitor

Re: Code that spans multiple lines?

"destruk" wrote:
The sdk makes this work with something similar to
result = myFunction( {"Parameter 1",
"Parameter 2",
"Parameter 3"} )


Data structure definitions (in this case you are passing an associative array as the single parameter) can span multiple lines, and if so the comma is optional. As far as I know, there's no way to span a statement across multiple lines, since there is no end of statement marker (such as semicolon).
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
RokuKevin
Visitor

Re: Code that spans multiple lines?

The end of line is a statement terminator, so it is meaningful much like a ';' in some other languages. Therefore you can't use the end of line as regular whitespace as you would in some other languages.

The associative array literal uses the line terminator as a field separator so it appears that the end of line is treated as normal whitespace in this case (because it doesn't end the statement), but it is not. It just has a different meaning.

--Kevin
0 Kudos