in reply to Messed up printing
The script is not outputting a "newline" character, "\n". Without that, it's possible that either the output buffer isn't being flushed (unlikely), or that the print is there, but without a new line, when the program terminates your command-line prompt is getting printed over your "Hello world".
This might happen, for example, if no newline is output, and yet when the command shell takes over upon program termination, it starts the prompt with a return to the leftmost screen column... on the same line that you just printed "Hello world".
Just to be on the safe side, until you get used to how buffering and newlines work, end your print statements with a '\n'. That's an overgeneralization, but you'll quickly catch on to when/where you need newlines after you've tinkered a few more hours.
I know this is probably not the right teaching example, but I used the technique of printing with \r (return), without \n (newline) to accomplish a JAPH that gave the visual impression of text sliding across the bottom of the screen. It's at: Slipery JAPH, if you're interested. ...just an aside; it's nothing serious.
The need to output newlines is not entirely foriegn to people familiar with C. The buffering is a little different, IIRC, but the principle is along the same lines.
Dave
|
|---|