Roku Developer Program

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

? ... --- ...

Today's wisecrack: did you know B/S implicitly supports Morse code? Smiley Tongue

Pop-quiz: "So you think you know BrightScript? Try to guess what the following will output:"
Brightscript Debugger> ? ... --- ...
0 Kudos
3 Replies
Highlighted
Level 11

Re: ? ... --- ...

haha same thing this outputs:

? ...


if you end with a hyphen, you get a syntax error.  if you print a dot, it outputs a zero.  fun stuff!
aspiring
0 Kudos
Highlighted
Level 10

Re: ? ... --- ...

"joetesta" wrote:
if you end with a hyphen, you get a syntax error.

So we shan't signal messages that end in any of 'AJKMOQTUVWXY' 8-)

if you print a dot, it outputs a zero.  fun stuff!

it's tad more complicated than that. SOS does not output 6 zeros
0 Kudos
Highlighted
Level 11

Re: ? ... --- ...

"EnTerr" wrote:
it's tad more complicated than that. SOS does not output 6 zeros

Is it?

? ......



Brightscript Debugger> ? ......
 0 0 0 0 0 0

Well something tricky is going on;

Brightscript Debugger> ? -.-.-.-.-.-.
 0

Brightscript Debugger> ? ------......
 0

Brightscript Debugger> ? ------ ......
 0

Brightscript Debugger> ? - .....
 0 0 0 0
 
Brightscript Debugger> ? -- .....
 0 0 0

Brightscript Debugger> ? --- ...
 0

Brightscript Debugger> ? --- ..
 0

Brightscript Debugger> ? --- ........
 0 0 0 0 0

So it seems each leading hyphen will remove one following period, but if there are any following periods it will always output at least one zero no matter how many leading hyphens there are.
hmm - no, these are not simple rules!

Brightscript Debugger> ? .....-----.
 0 0 0 0 0
aspiring
0 Kudos