HP Forums
Short hand for line feed (ppl)? - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Short hand for line feed (ppl)? (/thread-895.html)



Short hand for line feed (ppl)? - DrD - 03-13-2014 02:28 PM

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.


RE: Short hand for line feed (ppl)? - Han - 03-13-2014 02:57 PM

You can use "\n" in some cases, but not all commands recognize "\n"


RE: Short hand for line feed (ppl)? - patrice - 03-13-2014 04:55 PM

Each PRINT is on a new line already.
So to have a blank line
PRINT("");
Should do what you want.


RE: Short hand for line feed (ppl)? - DrD - 03-13-2014 07:30 PM

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");


RE: Short hand for line feed (ppl)? - patrice - 03-13-2014 07:54 PM

(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");



RE: Short hand for line feed (ppl)? - eried - 03-13-2014 08:25 PM

(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");



RE: Short hand for line feed (ppl)? - Han - 03-13-2014 09:10 PM

(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.


RE: Short hand for line feed (ppl)? - eried - 03-13-2014 09:26 PM

You can press enter too :O

Code:
PRINT("Hello
World");

or
Code:
PRINT("Hello"+"
"+"World");



RE: Short hand for line feed (ppl)? - DrD - 03-14-2014 12:59 AM

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-