Hello world/Newline omission: Difference between revisions

From Rosetta Code
Content added Content deleted
({{header|GUISS}})
Line 24: Line 24:
return EXIT_SUCCESS;
return EXIT_SUCCESS;
}</lang>
}</lang>

=={{header|GUISS}}==

In Graphical User Interface Support Script, we specify a newline, if we want one, so this will not produce a newline:

<lang GUISS>Start,Programs,Accessories,Notepad,Type:Goodbye World[pling]</lang>


=={{header|Perl}}==
=={{header|Perl}}==

Revision as of 01:48, 25 July 2011

Hello world/Newline omission is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

Some languages automatically insert a newline after outputting a string, unless measures are taken to prevent its output. The purpose of this task is to output the string "Goodbye, World!" to the terminal, preventing a trailing newline from occuring.

See also

BASIC

<lang basic>10 REM The trailing semicolon prevents a newline 20 PRINT "Goodbye World!";</lang>

C

In C, we do not get a newline unless we embed one:

<lang c>#include <stdio.h>

int main(int argc, char *argv[]) {

 (void) printf("Goodbye, World!");    /* No automatic newline */
 return EXIT_SUCCESS;

}</lang>

GUISS

In Graphical User Interface Support Script, we specify a newline, if we want one, so this will not produce a newline:

<lang GUISS>Start,Programs,Accessories,Notepad,Type:Goodbye World[pling]</lang>

Perl

<lang perl>print "Goodbye World!"; # A newline does not occur automatically</lang>

UNIX Shell

The behaviour of echo command is inconsistent across implementations. The -n parameter is not guaranteed to prevent a newline from occuring, so use a printf instead:

<lang sh>echo -n "Goodbye World!" # This may not work printf "Goodbye World!" # This works. newline is not automatically produced</lang>

ZX Spectrum Basic

<lang basic>10 REM The trailing semicolon prevents a newline 20 PRINT "Goodbye World!";</lang>