HP Forums

Full Version: Short hand for line feed (ppl)?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Print(char(10)); works ok, but is there a short hand notation that can be used or embedded in a print command for creating a new line? Something like "/n" for example.
You can use "\n" in some cases, but not all commands recognize "\n"
Each PRINT is on a new line already.
So to have a blank line
PRINT("");
Should do what you want.
Neither \n nor the "" approach seem to work when concatenated with additional info within a print command. (Something along these lines):

print( "something" + var +<some kind of newline shorthand> + "something else");
(03-13-2014 07:30 PM)DrD Wrote: [ -> ]Neither \n nor the "" approach seem to work when concatenated with additional info within a print command. (Something along these lines):

print( "something" + var +<some kind of newline shorthand> + "something else");
PRINT is pretty limited, so the easiest way is:
Code:
print( "something" + var );
print( "something else");
(03-13-2014 07:54 PM)patrice Wrote: [ -> ]PRINT is pretty limited, so the easiest way is:
Pretty limited for what? for drawing? for calculating? Tongue “Everything should be made as simple... you know the rest.

Code:
PRINT("Hello"+CHAR(10)+"World");
(03-13-2014 08:25 PM)eried Wrote: [ -> ]
(03-13-2014 07:54 PM)patrice Wrote: [ -> ]PRINT is pretty limited, so the easiest way is:
Pretty limited for what? for drawing? for calculating? Tongue “Everything should be made as simple... you know the rest.

Code:
PRINT("Hello"+CHAR(10)+"World");

If we want something like "\n" for repeated use, and prefer to not have to repeatedly type CHAR(10), perhaps the following may be useful:

Code:

nl:=char(10); // create a local variable outside of any program block

// then you can use something like:
print("Hello" + nl + "World");

Any future use of print that requires a newline character can simply use nl in place of char(10) -- smaller source file and less typing.
You can press enter too :O

Code:
PRINT("Hello
World");

or
Code:
PRINT("Hello"+"
"+"World");
I like the idea of creating a variable to hold the new line string. That solution seems to produce all the desirable features I was after, and helps keep the program structure nice and tidy. Thank for that idea!

-Dale-
Reference URL's