Topic Options
#57755 - 11/18/20 06:02 AM Code line continuation
tomekbe Offline
OL Newbie

Registered: 10/30/18
Posts: 7
Loc: Colchester, UK
Hi

A bit of a stupid question, but I can't find information on how to break line of code in Talk Code. For example in vbscript is a space and underscore ' _'
There is a possibility?

Top
#57756 - 11/18/20 08:01 AM Re: Code line continuation [Re: tomekbe]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 664
Loc: Québec, Canada
Unfortunately, there is no line continuation in PressTalk. Should you end up with very long line of code, I suggest you assign part of it into a variable as to keep your code readable.
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top
#57757 - 11/18/20 08:19 AM Re: Code line continuation [Re: tomekbe]
tomekbe Offline
OL Newbie

Registered: 10/30/18
Posts: 7
Loc: Colchester, UK
I asked because I have many array elements
"define(&varArray, arraystring, [&ADDR, &ADDR1, &ADDR2, &ADDR3, &ADDR4, &ADDR5, &ADDR6......"
and I have to add few new.
I have changed variables name to short so now is better smile

Thanks Jean smile
Tom

Top
#57758 - 11/18/20 08:28 AM Re: Code line continuation [Re: tomekbe]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 664
Loc: Québec, Canada
You could as well define your array with empty string and then assign each variable to a an array cell, as below:
Code:
define(&varArray, arraystring, ["","","","","","","",...
&varArray[0] := &ADDR1
&varArray[1] := &ADDR2
&varArray[2] := &ADDR3
&varArray[3] := &ADDR4
...

This way your code stays clean and you can name your variables as you like.
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top
#57759 - 11/18/20 08:52 AM Re: Code line continuation [Re: tomekbe]
tomekbe Offline
OL Newbie

Registered: 10/30/18
Posts: 7
Loc: Colchester, UK
I tried early to define array without elements but doesn't work smile

define(&varArray, arraystring,[])
&varArray[0] := &ADDR1
Show(&ADDR1)

Your idea make sense smile

Thanks for help Jean

Top
#57760 - 11/18/20 08:58 AM Re: Code line continuation [Re: tomekbe]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 664
Loc: Québec, Canada
The reason is that in PressTalk, there is no such thing as a dynamically sized array. You have to define it to its maximum possible size, and assign values to each cell.

It would help if you read our documentation on arrays
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top