Hello world/Newline omission: Difference between revisions
m
→{{header|Binary Lambda Calculus}}
Jazzedpineda (talk | contribs) (Omit Craft Basic) |
|||
(15 intermediate revisions by 8 users not shown) | |||
Line 242:
<syntaxhighlight lang="befunge">"!dlroW ,eybdooG">:#,_@</syntaxhighlight>
=={{header|Binary Lambda Calculus}}==
Starting a program with any of the 16 ASCII characters from space to slash will copy the remainder to stdout, so for example
=={{header|Blade}}==
Line 248 ⟶ 254:
=={{header|bootBASIC}}==
"Goodbye, w" and "orld!" are printed on different lines because not enough characters are allowed per line to complete this task in one line, even for the most code golfed version.
<syntaxhighlight lang="
20 print "orld!";</syntaxhighlight>
Line 303 ⟶ 309:
=={{header|COBOL}}==
<syntaxhighlight lang="cobol"> IDENTIFICATION DIVISION.
PROGRAM-ID. GOODBYE-WORLD.
PROCEDURE DIVISION.▼
DISPLAY 'Goodbye, World!' WITH NO ADVANCING.
▲PROCEDURE DIVISION.
STOP RUN.
▲DISPLAY 'Goodbye, World!'
END PROGRAM GOODBYE-WORLD.</syntaxhighlight>
STOP RUN.</syntaxhighlight>▼
=={{header|CoffeeScript}}==
Line 439 ⟶ 442:
=={{header|EasyLang}}==
<
# write omits newline
=={{header|EchoLisp}}==
Line 510 ⟶ 517:
=={{header|Fantom}}==
<syntaxhighlight lang="
class Main {
Void main() {
// Print with newline
▲ echo("Goodbye, World!")
echo("Hello, World!")
// Or
Env.cur.out.printLine("Hello, World!")
// Print without a newline
Env.cur.out.print("Goodbye, world!")
// Also can get a reference to the standard output stream
out := Env.cur.out
out.print("Goodbye, world!")
out.flush() // and flush buffer if needed
// or method chain
out.print("Goodbye, world!").flush()
// Also we can an implement a user-defined method
print("Hello, world! I'm back!");
}
// User-defined 'print' method
private Void print(Str s) {
Env.cur.out.print(s)
}
}
</syntaxhighlight>
Line 542 ⟶ 573:
=={{header|FreeBASIC}}==
<syntaxhighlight lang="
Print "Goodbye, World!";
Sleep</syntaxhighlight>
Line 589 ⟶ 620:
=={{header|Gambas}}==
'''[https://gambas-playground.proko.eu/?gist=09c8c3464c556325f089f9e4c326eaca Click this link to run this code]'''
<syntaxhighlight lang="
Print "Goodbye, "; 'The semicolon stops the newline being added
Line 721 ⟶ 752:
=={{header|J}}==
With ''jconsole'', <code>stdout</code> can be used.
<syntaxhighlight lang="j">
<code>1!:2&4</code> returns its input unmodified. To avoid implicit output (which would repeat the output), when used interactively:
<syntaxhighlight lang="j"> put=: 0 0 $ 1!:2&4
put 'Goodbye, World!'
Goodbye, World!</syntaxhighlight>
However, J also works in graphical environments, which might not be connected to standard output.
'''Solution''':<code>prompt</code> from the misc package.
'''Example''':<syntaxhighlight lang="j"> load 'general/misc/prompt'
prompt 'Goodbye, World!'
Goodbye, World!</syntaxhighlight>
'''Notes''':
The specific session manager being used changes the context and therefore answer to this task.
With that said, <code>prompt</code> handles the most common cases (using binary output for jconsole, so no newline is appended; adjusting the REPL prompt in the desktop apps to to elide the newline which is normally included by default, etc).
For truly automated processes, you'd almost always want this kind of functionality (omitting the newline when printing) in a file- or stream-oriented application.
So, if a J programmer were asked to solve this task, the right approach would be to ask why that is needed, and then craft a solution appropriate to that situation.
Line 1,347 ⟶ 1,383:
Ursa doesn't output a newline to an I/O device by default, so simply omitting an endl object at the end of the output stream is all that's needed.
<syntaxhighlight lang="ursa">out "goodbye world!" console</syntaxhighlight>
=={{header|Uxntal}}==
<syntaxhighlight lang="Uxntal">|00 @System &vector $2 &expansion $2 &wst $1 &rst $1 &metadata $2 &r $2 &g $2 &b $2 &debug $1 &state $1
|10 @Console &vector $2 &read $1 &pad $4 &type $1 &write $1 &error $1
|0100
;message
&loop
LDAk .Console/write DEO
INC2 LDAk ?&loop
POP2
#80 .System/state DEO
BRK
@message "Goodbye, 20 "World! 00</syntaxhighlight>
=={{header|Vale}}==
Line 1,393 ⟶ 1,444:
=={{header|Wren}}==
<syntaxhighlight lang="
=={{header|XLISP}}==
|