#195845 - 2009-09-10 02:58 PM
Line Break
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
|
In VBS you can do a line break, like:
"some string" &_
"some other string"
Is there a KiX variant?
I know, strange question comming from me, but I never had the need to do so, and I never believe in line breaks, but now I am in a position where I have to do so
|
Top
|
|
|
|
#195848 - 2009-09-10 03:29 PM
Re: Line Break
[Re: Allen]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
Without the + is IMHO not the same
$RC = "aze"
"rty"
???
? "Var RC = " $RC
$RC = "aze" +
"rty"
???
? "Var RC = " $RC
Output to screen:
rty
Var RC = aze
Var RC = azerty
|
Top
|
|
|
|
#195851 - 2009-09-10 04:40 PM
Re: Line Break
[Re: Allen]
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
It works with any construct where you can insert whitespace.
The KiXtart interpreter treats all whitespace (space, tab, newline) the same in almost all circumstances. Comments are one obvious exception, and I think I've encounter one or two others.
It is often useful to break up long function calls:
$foo=Bar(
$Parameter1,
$Parameter2,
$Parameter2
)
It's a personal choice, but when it comes to catenating long strings I prefer to put the operator at the start of the line to make it clear that it is a continuation, for example instead of:
$LongString="This " +
"is a string " +
"of many parts!" I prefer
$LongString="This"
+ " is a string"
+ " of many parts!"
|
Top
|
|
|
|
#195855 - 2009-09-10 05:01 PM
Re: Line Break
[Re: Richard H.]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
If you don't like Tabs
$LongString = 'Blablabla'
$LongString = $LongString + 'RestOfBlaBlaBla'
$LongString = $LongString + ' And Add Some NagNagNag'
|
Top
|
|
|
|
#195893 - 2009-09-14 09:12 AM
Re: Line Break
[Re: Witto]
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
|
Thanks guys! I should have been more specific. the code would be something like:
$arrTest = "test1","test2","test3"
"test4","test5"
Edited by apronk (2009-09-14 09:12 AM)
|
Top
|
|
|
|
#195895 - 2009-09-14 09:17 AM
Re: Line Break
[Re: Arend_]
|
Arend_
MM club member
Registered: 2005-01-17
Posts: 1895
Loc: Hilversum, The Netherlands
|
So in effect:
$arrTest = "test1","test2","test3"
+ "test4","test5"
|
Top
|
|
|
|
#195899 - 2009-09-14 10:20 AM
Re: Line Break
[Re: Arend_]
|
Richard H.
Administrator
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
So in effect:
$arrTest = "test1","test2","test3"
+ "test4","test5"
No that would be incorrect - you are catenating test3 and test4 when presumably you intend to create an array of 5 elements.
All you need to do is put @CRLF where you could put a space or tab character, so your code should look like:
$arrTest = "test1","test2","test3"
,"test4","test5"
It's your choice on which line you place the comma across the split, it should work as the final character on the first line or the first (non-whitespace) character on the second.
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 369 anonymous users online.
|
|
|