Continuation character in WIL script

Started by stevengraff, January 23, 2014, 05:08:45 AM

Previous topic - Next topic

stevengraff

Is there a way to break up a statement onto multiple lines (for "readability"), but still have it interpreted as if it were on a single line?


stanl

Define 'statement': do you mean a WB command, or something like an SQL statement that is 4-500 characters in length?

snowsnowsnow

I assume we are talking about a statement in a WB program (Note to readers: THis is a WinBatch forum, not a SQL forum, not a VB forum, and not a C forum).

And, in that case, the answer is "No."

The question has come up before.


Deana

WinBatch doesn't offer a "line continuation" character.

One technique is dealing with really long strings of data is to use the string concatenation operator to build a long string yet, still display the data so that it is readable.
Code (winbatch) Select
str = '0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'
str = str: '0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'
str = str:  '0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789'
Deana F.
Technical Support
Wilson WindowWare Inc.

stanl

also useful if writing WB scripts using COM/CLR and talking to database tables with SQL [even though this is not a SQL Forum]

Code (WINBATCH) Select


cSQL='SELECT myfirstcolumn, mysecondcolumn, mythirdcolumn, myfourthcolumn, myfifthcolumn '
cSQL=cSQL:'mysixthcolumn,myseventhcolumn,myeighthcolumn,myninethcolumn,mycolumnthirty '
cSQL=cSQL:'FROM myfirsttable WHERE myeleventhcolumn="some value";'
;;;;.....
oConn.Execute(cSQL)

stevengraff

Thanks; I've done that before. You're right, it's very usefull.

DAG_P6

Another place in which line continuation characters are extremely useful is in calls to functions that have long argument lists. Better yet would be the ability to insert line comments, as is often done in C and C++ code. I have seen, and written such calls that make good use of such inline comments to list the parameter names as they appear in the C/C++ header file in which the function is declared. This can be very handy when you think the actual arguments are out of order.

BTW, I know this isn't a C/C++ forum, but that doesn't preclude borrowing ideas from other languages, including C and C++, bearing in mind that the mere presence of a feature doesn't mean that everyone must use it.
David A. Gray
You are more important than any technology.

MiloradM

I know this is old post, but I am new in WinBatch and I very miss possibility of splitting program lines into multiple lines.

Every programming language I know (except old Fortran, I think) have this possibility (I did work on more than 15 languages), and now I call WinBatch authors to implement such feature in their very good and useful product.

Or, maybe that feature was already implemented from last post in this theme?

stanl

There was a more recent thread about this where Jim asked about a StrCatEx() function and we discussed that versus delimiters, i.e. /* ..... */

And I believe Tony implemented something in WB, and I am sure he will chime in with how things turned out.

kdmoyers

It's not really "line continuation" but there is this feature for long strings:
Code (winbatch) Select
HeaderText = $"
This program takes a quote number and produces an estimate of freight price for
various services, IF it can find sufficient historical examples to estimate from.
You can deselect items that are not part of the estimate.
$"

This works well for me, as all my cases of too-long statements are really cases
of too-long strings.
The mind is everything; What you think, you become.