Board index » delphi » Real easy Pascal question

Real easy Pascal question

I have a real stupid, easy question....

When Your line is too big, what do you do to it when it continues one
line down..

ex.
                  v---line ends here. what continues line here?
 code....code... co                                     |
        de?     <---------------------------------------|

 

Re:Real easy Pascal question


Quoting a message by Rudy C Callbeck <rcc...@mail.usask.ca> in
comp.lang.pascal.borland:

Quote
>I have a real stupid, easy question....

Heh.. I was there too - but to me, it was a frustrating ordeal to figure
it out :>

Quote
>When Your line is too big, what do you do to it when it continues one
>line down..

You mean, like;

WriteLn('I''m a really long line. Let''s say the end of the screen is ' +
         'right there!');

??

Of course, you don't need to indent it quite like that.

--

= Stewart Honsberger (AKA Blackdeath)
= Web: http://sprk.com/blackdeath ICQ UIN: 3484915
= Remove 'thir{*word*249}' to reply privately

... I'm not responsible for contents of posts made after midnight!!
-!- GOPGP/2 v1.21

Re:Real easy Pascal question


On Mon, 22 Mar 1999 19:43:19 -0600, Rudy C Callbeck

Quote
<rcc...@mail.usask.ca> wrote:
>I have a real stupid, easy question....

>When Your line is too big, what do you do to it when it continues one
>line down..

>ex.
>              v---line ends here. what continues line here?
> code....code... co                                 |
>    de?     <---------------------------------------|

Line breaks are just like any other white space (such as blanks and
tabs).  A logical line can span many physical lines.  You tell the
compiler where the logical line ends by terminating it with a
semicolon.  (Strictly speaking, you don't even need the semicolon if
the next statement begins with the "end" reserved word.)

Note that you can't break a line in the middle of a word, as you do in
your example.

Re:Real easy Pascal question


Quote
Steven Sommer wrote:
> Note that you can't break a line in the middle of a word, as you do in
> your example.

... or in the middle of a string literal.  You must terminate the string
and concatenate a new one on the next line, as Stewart demonstrated in
his example.

     - Rich

Re:Real easy Pascal question


Quote
Rudy C Callbeck wrote:
> I have a real stupid, easy question....

> When Your line is too big, what do you do to it when it continues one
> line down..

     I'm not 100% sure of your question.  Do you mean "when, in writing
Pascal code,
is it "legal" to break a line and continue on the next line", or "when
writing output to the
screen or a file, when can I break the line"?  In some sense, the answer
to both questions
is "whereever you like, provided you don't "break up" a unit".  If you
are formatting output, you are clearly "allowed" to put line breaks
whereever you want, but you should
think about how it will look.  If you are writing code, you can put line
breaks anywhere
you want as long as you don't break up such things as words, symbols
(e.g. ":="), and
literals (including strings).  Again, you will probably want to put line
breaks where it will
make your code "look nicest".

     complexexpression := complexfunction (arg1, arg2) +
anothercomplexfunction (arg1,
        arg2, arg3)
or
     complexexpression := complexfunction (arg1, arg2) +
        anothercomplexfunction (arg1, arg2, arg3)

I personally prefer the second example as it keeps the code more
"human-logically" grouped.  Both, however, would compile identically.

Bob Schor
Pascal Enthusiast

Other Threads