Hello world/Text: Difference between revisions
This version technically worked in the Waduzitdo web interpreter, but I'm sure some implementations require the stop run command S: so I finally gave the program a proper end
(This version technically worked in the Waduzitdo web interpreter, but I'm sure some implementations require the stop run command S: so I finally gave the program a proper end) |
|||
(207 intermediate revisions by more than 100 users not shown) | |||
Line 16:
=={{header|0815}}==
<
<:48:x<:65:=<:6C:$=$=$$~<:03:+
$~<:ffffffffffffffb1:+$<:77:~$
Line 22:
<:06:x-$x<:0e:x-$=x<:43:x-$
</syntaxhighlight>
=={{header|11l}}==
<syntaxhighlight lang
=={{header|360 Assembly}}==
Using native SVC (Supervisor Call) to write to system console:
<syntaxhighlight lang="360 assembly">
HELLO CSECT
USING HELLO,15
Line 39:
DC XL2'00' 2 bytes binary of zeros
DC C'Hello world!' Text to be written to system console
END</
Using WTO Macro to generate SVC 35 and message area:
<
BR 14 Return
END
</syntaxhighlight>
=={{header|IBM Z HL/ASM}}==
Using Modern IBM Z High Level assembler to write 'Hello World' to the Unix System Services 'stdout' file descriptor
<syntaxhighlight lang="360 assembly">
PRINT ON,GEN,DATA
HELLO CSECT
HELLO RMODE ANY
HELLO AMODE 31
*
* Prolog
*
SAVE (14,12)
BASR R12,0
USING *,R12
STORAGE OBTAIN,LENGTH=DYNL,ADDR=(R11)
USING DYNAREA,R11
LA R2,DSA
ST R2,8(,R13)
ST R13,DSA+4
LR R13,R2
*
* Body
* Write Hello World to STDOUT
*
*
* Store values into parameter list
*
MVC REC(HWL),HW
LA R1,REC
ST R1,RECA
LA R1,HWL
ST R1,RECL
L R1,STDOUT
ST R1,FD
L R1,BPXALET
ST R1,ALET
CALL BPX1WRT,(FD, x
RECA, x
ALET, x
RECL, x
RV, x
RC, x
RN),MF=(E,BPXWRTD)
L R8,RV
L R9,RC
L R10,RN
*
* Epilog
*
L R13,DSA+4
STORAGE RELEASE,LENGTH=DYNL,ADDR=(R11)
RETURN (14,12),RC=0
*
* Statics, Dynamic Storage, Equates follows
*
* Naming convention:
* Suffixes:
* L : length
* S : static
* D : dynamic
* A : address
LTORG
*
* Statics (constants)
*
STDIN DC F'0'
STDOUT DC F'1'
STDERR DC F'2'
BPXALET DC F'0'
BPX1WRT DC V(BPX1WRT)
BPXWRTS CALL ,(0,0,0,0,0,0,0),MF=L
BPXWRTL EQU *-BPXWRTS
HW DC C'Hello World'
NEWLINE DC X'15'
HWL EQU *-HW
*
* Dynamic (storage obtain'ed) area
*
DYNAREA DSECT
*
* Dynamic Save Area regs always first
*
DSA DS 18F
*
* Working storage
*
FD DS F
RECSIZE EQU RECEND-*
REC DS CL80
RECEND EQU *
RECA DS A
BPXWRTD DS CL(BPXWRTL)
ALET DS F
RECL DS F
RV DS F
RC DS F
RN DS F
DYNL EQU *-DYNAREA
*
*
* End of working storage
*
*
* Equates
*
R0 EQU 0
R1 EQU 1
R2 EQU 2
R3 EQU 3
R4 EQU 4
R5 EQU 5
R6 EQU 6
R7 EQU 7
R8 EQU 8
R9 EQU 9
R10 EQU 10
R11 EQU 11
R12 EQU 12
R13 EQU 13
R14 EQU 14
R15 EQU 15
END
</syntaxhighlight>
=={{header|4DOS Batch}}==
<syntaxhighlight lang
=={{header|6502 Assembly}}==
<
; String printing limited to strings of 256 characters or less.
Line 71 ⟶ 207:
text:
.byte "Hello world!", a_cr, 0</
=={{header|6800 Assembly}}==
<syntaxhighlight lang="text"> .cr 6800
.tf gbye6800.obj,AP1
.lf gbye6800
Line 104 ⟶ 240:
;=====================================================;
string .as "Hello world!",#13,#10,#0
.en</
=={{header|8080 Assembly}}==
<
; As you can see, it is similar to the 8086, and CP/M is very
; similar to DOS in the way it is called.
Line 118 ⟶ 254:
; JMP saves a byte (if you've only got 64k of address space you want to
; save bytes).
msg: db 'Hello world!$'</
=={{header|8086 Assembly}}==
<
.MODEL TINY
.DATA
Line 137 ⟶ 273:
MOV AX, 4C00h ; go back to DOS
INT 21h
END START</
With A86 or NASM syntax:
Line 153 ⟶ 289:
=={{header|8th}}==
<
=={{header|AArch64 Assembly}}==
<
.equ SVC_WRITE, 64
.equ SVC_EXIT, 93
Line 177 ⟶ 313:
msg: .ascii "Hello World!\n"
.align 4</
=={{header|ABAP}}==
<
WRITE 'Hello world!'.</
=={{header|ACL2}}==
<
=={{header|Acornsoft Lisp}}==
Since there is no string data type in the language, a symbol (an identifier or 'character atom') must be used instead. When writing a symbol in source code, exclamation mark is an escape character that allows characters such as spaces and exclamation marks to be treated as part of the symbol's name. Some output functions will include exclamation mark escapes when outputting such symbols, and others, such as <code>printc</code>, will not.
<syntaxhighlight lang="lisp">(printc 'Hello! world!!)</syntaxhighlight>
The single quote in front of <code>Hello! world!!</code> makes it an expression that evaluates to the symbol itself; otherwise, it would be treated as a variable and its value (if it had one) would be printed instead.
=={{header|Action!}}==
<syntaxhighlight lang="action!">Proc Main()
Print("Hello world!")
Return</syntaxhighlight>
=={{header|ActionScript}}==
<
=={{header|Ada}}==
{{works with|GCC|4.1.2}}
<
procedure Main is
begin
Put_Line ("Hello world!");
end Main;</
=={{header|Agda}}==
For Agda 2.6.3, based on its [https://agda.readthedocs.io/en/v2.6.3/getting-started/hello-world.html documentation].
<syntaxhighlight lang="agda">module HelloWorld where
open import Agda.Builtin.IO using (IO)
open import Agda.Builtin.Unit renaming (⊤ to Unit)
open import Agda.Builtin.String using (String)
postulate putStrLn : String -> IO Unit
{-# FOREIGN GHC import qualified Data.Text as T #-}
{-# COMPILE GHC putStrLn = putStrLn . T.unpack #-}
main : IO Unit
main = putStrLn "Hello world!"
</syntaxhighlight>
=={{header|Agena}}==
<
=={{header|Aime}}==
<
or:
<
main(void)
{
Line 211 ⟶ 376:
return 0;
}</
=={{header|Algae}}==
<
=={{header|ALGOL 60}}==
<
OUTSTRING(1,'('Hello world!')');
SYSACT(1,14,1)
'END'</
=={{header|ALGOL 68}}==
<
printf($"Hello world!"l$)
)</
=={{header|ALGOL W}}==
<
write( "Hello world!" )
end.</
=={{header|ALGOL-M}}==
<
WRITE( "Hello world!" );
END</
=={{header|Alore}}==
<syntaxhighlight lang
=={{header|Amazing Hopper}}==
1)
<syntaxhighlight lang="amazing hopper">
main:
{"Hello world!\n"}print
exit(0)
</syntaxhighlight>
<pre>execute with: hopper helloworld.com</pre>
2)
<syntaxhighlight lang="amazing hopper">
#include <hopper.h>
main:
exit("Hello world!\n")
</syntaxhighlight>
<pre>execute with: hopper helloworld.com -d</pre>
3)
<syntaxhighlight lang="amazing hopper">
main:
{"Hello world!\n"}return
</syntaxhighlight>
<pre>execute with: hopper helloworld.com -d</pre>
=={{header|AmbientTalk}}==
<
=={{header|AmigaE}}==
<
WriteF('Hello world!\n')
ENDPROC</
=={{header|AngelScript}}==
<syntaxhighlight lang="angelscript">void main() { print("Hello world\n"); }</syntaxhighlight>
=={{header|AntLang}}==
Note, that "Hello, World!" prints twice in interactive mode.
One time as side-effect and one as the return value of echo.
<
=={{header|Anyways}}==
<
"Ow!" it said.
That's all folks!</
=={{header|APL}}==
<syntaxhighlight lang
=={{header|AppleScript}}==
To show in Script Editor Result pane:
<
To show in Script Editor Event Log pane:
<
=={{header|Applesoft BASIC}}==
Line 274 ⟶ 464:
Important Note: Although Applesoft BASIC allowed the storage and output of mixed-case strings, the ability to enter mixed-case via the keyboard and to output mixed-case on the default display was not offered as standard equipment on the original Apple II/II+. Since Applesoft WAS the default programming language for the Apple II+, perhaps some flexibility in the task specification could be offered, for this and for other systems that lacked proper mixed-case I/O capabilities in at least one popular configuration.
<syntaxhighlight lang="applesoft
=={{header|Apricot}}==
<
=={{header|Arc}}==
<
=={{header|Arendelle}}==
Line 286 ⟶ 476:
=={{header|Argile}}==
<
print "Hello world!"</
compile with: arc hello_world.arg -o hello_world.c && gcc -o hello_world hello_world.c
=={{header|ARM Assembly}}==
<
message:
Line 303 ⟶ 493:
mov r7, #1
swi 0</
Alternative versions
<pre>
Developed on an Acorn A5000 with RISC OS 3.10 (30 Apr 1992)
Using the assembler contained in ARM BBC BASIC V version 1.05 (c) Acorn 1989
The Acorn A5000 is the individual computer used to develop the code,
the code is applicable to all the Acorn Risc Machines (ARM)
produced by Acorn and the StrongARM produced by digital.
In the BBC BASIC part of the program I have included:
OS_WriteC = &00
OS_WriteO = &02
OS_NewLine = &03
this is so I can write SWI OS_WriteC etc instead of SWI &0 to make the assembler more legible
(a) method1 - output the text character by character until the terminating null (0) is seen
.method1_vn00
ADR R8 , method1_string \ the ARM does not have an ADR instruction
\ the assembler will work out how far the data item
\ is from here (in this case a +ve relative offset)
\ and so will produce an ADD R8 , PC, offset to method1_string
\ a magic trick by the ARM assembler
.method1_loop
LDRB R0 , [R8], #1 \ load the byte found at address in R8 into R0
\ then post increment the address in R8 in preparation
\ for the next byte (the #1 is my choice for the increment)
CMP R0 , #0 \ has the terminating null (0) been reached
SWINE OS_WriteC \ when not the null output the character in R0
\ (every opportunity to have a SWINE in your program should be taken)
BNE method1_loop \ go around the loop for the next character if not reached the null
SWI OS_NewLine \ up to you if you want a newline
MOVS PC , R14 \ return
\ when I call an operating system function it no longer operates
\ in 'user mode' and it has its own R14, and anyway the operating system
\ is too polite to write rubbish into this return address
.method1_string
EQUS "Hello world!" \ the string to be output
EQUB &00 \ a terminating null (0)
ALIGN \ tell the assembler to ensure that the next item is on a word boundary
(b) method2 - get the supplied operating system to do the work
.method2_vn00
ADR R0 , method2_string \ the ARM does not have an ADR instruction
\ the assembler will work out how far the data item
\ is from here (in this case a +ve relative offset)
\ and so will produce an ADD R0 , PC, offset to method2_string
\ a magic trick by the ARM assembler
SWI OS_WriteO \ R0 = pointer to null-terminated string to write
SWI OS_NewLine \ up to you if you want a newline
MOVS PC , R14 \ return
.method2_string
EQUS "hELLO WORLD!" \ the string to be output
EQUB &00 \ a terminating null (0)
ALIGN \ tell the assembler to ensure that the next item is on a word boundary
</pre>
=={{header|ArnoldC}}==
<
TALK TO THE HAND "Hello world!"
YOU HAVE BEEN TERMINATED</
=={{header|Arturo}}==
<
{{out}}
Line 319 ⟶ 580:
=={{header|AsciiDots}}==
<syntaxhighlight lang="asciidots">
.-$'Hello, World!'
</syntaxhighlight>
=={{header|Astro}}==
<
=={{header|Asymptote}}==
<syntaxhighlight lang="asymptote">write('Hello world!');</syntaxhighlight>
=={{header|Atari BASIC}}==
<syntaxhighlight lang="Atari BASIC">10 PRINT "Hello World"</syntaxhighlight>
=={{header|ATS}}==
<
=={{header|AutoHotkey}}==
script launched from windows explorer
<
FileAppend, Goodbye`, World!, CONOUT$
FileReadLine, _, CONIN$, 1</
scripts run from shell
[requires Windows XP or higher; older Versions of Windows don´t have the "AttachConsole" function]
<
FileAppend, Goodbye`, World!, CONOUT$</
<syntaxhighlight lang
=={{header|AutoIt}}==
<
=={{header|AutoLISP}}==
<
=={{header|Avail}}==
<
=={{header|AWK}}==
<
"BEGIN" is a "special pattern" - code within "{}" is executed before the input file is read, even if there is no input. "END" is a similar pattern, for after completion of main processing.
<
END {
print "Hello world!"
}
</syntaxhighlight>
For a file containing data, the work can be done in the "body". The "//" is "match anything" so gets the first data, the "exit" halts processing the file (any "END" would then be executed). Or instead of //, simply 1 is true.
<
// {
print "Hello world!"
exit
}
</syntaxhighlight>
For a "single record" file.
<
// {
print "Hello world!"
}
</syntaxhighlight>
For a "single record" file containing - Hello world! -. The "default" action for a "pattern match" (the "/" and "/" define a "pattern" to match data) is to "print" the record.
<
//
</syntaxhighlight>
=={{header|Axe}}==
Note that the i here is the imaginary ''i'', not the lowercase letter i.
<
=={{header|B}}==
{{works with|The Amsterdam Compiler Kit - B|V6.1pre1}}
<
{
putstr("Hello world!*n");
return(0);
}</
=={{header|B4X}}==
<
=={{header|Babel}}==
<
=={{header|BabyCobol}}==
<syntaxhighlight lang="cobol">
* Since no quotes are used, two undeclared fields (variables) are printed.
* Their default values are their own names in uppercase.
IDENTIFICATION DIVISION.
PROGRAM-ID. USER OUTPUT.
PROCEDURE DIVISION.
DISPLAY HELLO WORLD.
</syntaxhighlight>
=={{header|Bait}}==
<syntaxhighlight lang="bait">fun main() {
println('Hello World!')
}</syntaxhighlight>
=={{header|Ballerina}}==
<syntaxhighlight lang="ballerina">import ballerina/io;
public function main() {
io:println("Hello World!");
}</syntaxhighlight>
=={{header|bash}}==
<
=={{header|BASIC}}==
{{works with|BASICA}}
{{works with|Chipmunk Basic}}
{{works with|Commodore BASIC}}
{{works with|GW-BASIC}}
{{works with|IS-BASIC}}
{{works with|Just BASIC}}
{{works with|Liberty BASIC}}
{{works with|Locomotive Basic}}
{{works with|M2000 Interpreter}}
{{works with|MSX BASIC}}
{{works with|QBasic}}
{{works with|Quite BASIC}}
{{works with|Run BASIC}}
{{works with|Tiny BASIC}}
{{works with|ZX Spectrum Basic}}
<syntaxhighlight lang="qbasic">10 print "Hello world!"</syntaxhighlight>
{{works with|7Basic}}
{{works with|Applesoft BASIC}}
{{works with|BaCon}} [[Category:BaCon]]
{{works with|
{{works with|FreeBASIC}}
{{works with|IS-BASIC}}
{{works with|M2000 Interpreter}}
{{works with|QBasic}}
{{works with|QB64}}
{{works with|Script Basic}}
{{works with|SmallBASIC}}
{{works with|Yabasic}}
<syntaxhighlight lang="qbasic">PRINT "Hello world!"</syntaxhighlight>
=={{header|BASIC256}}==
<
=={{header|Batch File}}==
'''Under normal circumstances, when delayed expansion is disabled'''
<syntaxhighlight lang
'''If delayed expansion is enabled, then the ! must be escaped twice'''
<
echo Hello world!^^!</
=={{header|Battlestar}}==
<!--- supports C syntax highlighting --->
<
print(hello)</
=={{header|BBC BASIC}}==
<
=={{header|bc}}==
<
"</
=={{header|BCPL}}==
<
LET start() = VALOF
{ writef("Hello world!")
RESULTIS 0
}</
=={{header|Beef}}==
<syntaxhighlight lang=csharp>Using System;
namespace HelloWorld {
class Program
{
static void Main()
{
Console.Writeln("Hello World!");
}
}
}
</syntaxhighlight>
=={{header|beeswax}}==
Straightforward:
<syntaxhighlight lang
Less obvious way:
<
`
r
Line 467 ⟶ 783:
W
`
b` ,olleH`_</
Even less obvious, demonstrating the creation and execution order of instruction pointers, and the hexagonal layout of beeswax programs:
<
l o
``
Line 477 ⟶ 793:
``
e H
W</
=={{header|Befunge}}==
<
=={{header|Binary Lambda Calculus}}==
As explained at https://www.ioccc.org/2012/tromp/hint.html
<pre> Hello world!</pre>
=={{header|Bird}}==
It's not possible to print exclamation marks in [[Bird]] which is why it is not used in this example.
<
define Main
Console.Println "Hello world"
end</
=={{header|Blade}}==
<syntaxhighlight lang="blade">echo 'Hello world!'</syntaxhighlight>
or
<syntaxhighlight lang="blade">print('Hello world!')</syntaxhighlight>
or
<syntaxhighlight lang="blade">import io
io.stdout.write('Hello world!')</syntaxhighlight>
=={{header|Blast}}==
<
.begin
display "Hello world!"
return
# This is the end of the script.</
=={{Header|BlitzMax}}==
<syntaxhighlight lang="blitzmax">
print "Hello world!"
</syntaxhighlight>
=={{header|Blue}}==
Linux/x86
<syntaxhighlight lang="blue">global _start
: syscall ( num:eax -- result:eax ) syscall ;
: exit ( status:edi -- noret ) 60 syscall ;
: bye ( -- noret ) 0 exit ;
1 const stdout
: write ( buf:esi len:edx fd:edi -- ) 1 syscall drop ;
: print ( buf len -- ) stdout write ;
: greet ( -- ) s" Hello world!\n" print ;
: _start ( -- noret ) greet bye ;</syntaxhighlight>
=={{header|blz}}==
<
=={{header|BML}}==
<
=={{header|Boo}}==
<
=={{header|bootBASIC}}==
<
=={{header|BQN}}==
Works in: [[CBQN]]
<syntaxhighlight lang="bqn">•Out "Hello world!"</syntaxhighlight>
=={{header|Brace}}==
<
use b
Main:
say("Hello world!")</
=={{header|Bracmat}}==
<
=={{header|Brainf***}}==
Line 535 ⟶ 894:
Commented version:
<
[
Line 593 ⟶ 952:
CRLF
< +++ . --- .</
Uncommented:
<
++++++++>+++++++++++>++++++++++++<<<<<<<<<-]>>>>+.>>>
>+..<.<++++++++.>>>+.<<+.<<<<++++.<++.>>>+++++++.>>>.+++.
<+++++++.--------.<<<<<+.<+++.---.</
It can most likely be optimized, but this is a nice way to show
how character printing works in Brainf*** :)
=={{header|Brat}}==
<
=={{header|Brlcad}}==
Line 610 ⟶ 969:
The mged utility can output text to the terminal:
<
echo Hello world!
</syntaxhighlight>
=={{header|Bruijn}}==
Ignore stdin by not referring to the abstraction:
<syntaxhighlight lang="bruijn">
main ["Hello world!"]
</syntaxhighlight>
=={{header|Burlesque}}==
<
"Hello world!"sh
</syntaxhighlight>
Although please note that ''sh'' actually does not print anything.
Line 624 ⟶ 991:
=={{header|C}}==
{{works with|gcc|4.0.1}}
<
#include <stdio.h>
Line 631 ⟶ 998:
printf("Hello world!\n");
return EXIT_SUCCESS;
}</
Or:
<
#include <stdio.h>
Line 640 ⟶ 1,007:
puts("Hello world!");
return EXIT_SUCCESS;
}</
Or, the eternal favourite :)
<syntaxhighlight lang="c">
#include<stdio.h>
Line 649 ⟶ 1,016:
printf("\nHello world!");
return 0;
}</
or better yet...
<syntaxhighlight lang="c">
#include<stdio.h>
Line 659 ⟶ 1,026:
return printf("\nHello World!");
}
</syntaxhighlight>
=={{header|C sharp|C#}}==
{{works with|Mono|1.2}}
{{works with|Visual C sharp|Visual C#|2003}}
<
{
class Program
Line 673 ⟶ 1,040:
}
}
}</
{{works with|Visual C sharp|Visual C#|9.0+}}
C# 9.0 allows statements at the top level of a source file (a ''compilation_unit'' in the specification) between any using statements and namespace declarations. These statements become the program entry point and are placed in a method in a compiler-generated type.
<syntaxhighlight lang="csharp">System.Console.WriteLine("Hello world!");</syntaxhighlight>
or
<syntaxhighlight lang="csharp">using System;
Console.WriteLine("Hello world!");</syntaxhighlight>
=={{header|C++}}==
<
int main
std::cout << "Hello world!\n"
}</
Since C++23’s addition of the <code><print></code> header and the standard library module <code>std</code> we could now write this:
<syntaxhighlight lang="cpp">import module std; // here does the same thing as #include <print>
int main() {
std::print("Hello world!\n");
}</syntaxhighlight>
=={{header|C++/CLI}}==
<
int main()
{
Console::WriteLine("Hello world!");
}</
=={{header|C1R}}==
<syntaxhighlight lang
{{out}}
<pre>
Line 700 ⟶ 1,080:
=={{header|C2}}==
<
import stdio as io;
Line 706 ⟶ 1,086:
io.printf("Hello World!\n");
return 0;
}</
=={{header|C3}}==
<syntaxhighlight lang="c3">import std::io;
fn void main()
{
io::printn("Hello, World!");
}</syntaxhighlight>
=={{header|Casio BASIC}}==
<
or just
<syntaxhighlight lang="basic
=={{header|Cat}}==
<
=={{header|Cduce}}==
<
=={{header|CFEngine}}==
<syntaxhighlight lang="cfengine3">#!/usr/bin/env cf-agent
# without --no-lock option to cf-agent
# this output will only occur once per minute
# this is by design.
bundle agent main
{
reports:
"Hello world!";
}</syntaxhighlight>
See https://docs.cfengine.com/docs/master/examples.html for a more complete example and introduction.
=={{header|Chapel}}==
<
=={{header|Chef}}==
<
Ingredients.
Line 758 ⟶ 1,159:
Pour contents of the mixing bowl into the baking dish.
Serves 1.</
=={{header|Chipmunk Basic}}==
<syntaxhighlight lang="qbasic">10 print "Hello world!"</syntaxhighlight>
=={{header|ChucK}}==
<syntaxhighlight lang="text"><<< "Hello world!">>>;</
=={{header|Cind}}==
<
execute() {
host.println("Hello world!");
}
</syntaxhighlight>
=={{header|Clay}}==
<
println("Hello world!");
}</
=={{header|Clean}}==
<
=={{header|Clio}}==
<
=={{header|Clipper}}==
<
=={{header|CLIPS}}==
<
=={{header|CLU}}==
<syntaxhighlight lang="clu">start_up = proc ()
po: stream := stream$primary_output()
stream$putl(po, "Hello world!")
end start_up</syntaxhighlight>
=={{header|Clojure}}==
<
=={{header|CMake}}==
<
This outputs
Line 803 ⟶ 1,213:
{{works with|Dell Enterprise COBOL}}
<
procedure division.
display "Hello world!".
stop run.</
Using relaxed compilation rules, the hello program can become a single DISPLAY statement.
{{works with|GnuCOBOL}}
<
<pre>prompt$ cobc -x -frelax-syntax -free hello.cob
Line 823 ⟶ 1,233:
=={{header|Cobra}}==
<
def main
print 'Hello world!'</
=={{header|CoffeeScript}}==
{{works with|Node.js}}
<
{{works with|Rhino engine}}
<
=={{header|ColdFusion}}==
<
=={{header|Comal}}==
<
=={{header|Comefrom0x10}}==
<syntaxhighlight lang
<
=={{header|Commodore BASIC}}==
By default some Commodore computers boot into uppercase/graphics mode (C64, C128, VIC-20, Plus 4, etc.) while others (PET, CBM etc.) boot into lowercase/uppercase mode. Therefore, depending on machine used, the CHR$(14) may or may not be required to switch into mixed-case mode.
<
20 print "Hello world!"
30 end
</syntaxhighlight>
{{Out}}<pre>Hello world!</pre>
=={{header|Common Lisp}}==
<
Or
<
===Alternate solution===
I use [https://franz.com/downloads/clp/survey Allegro CL 10.1]
<
;; Project : Hello world/Text
(format t "~a" "Hello world!")
</syntaxhighlight>
Output:
<pre>
Line 874 ⟶ 1,284:
=={{header|Component Pascal}}==
<
MODULE Hello;
IMPORT Out;
Line 882 ⟶ 1,292:
Out.String("Hello world!"); Out.Ln
END Do;
END Hello.</
Run command ''Hello.Do'' by commander.
=={{header|Coq}}==
<syntaxhighlight lang="coq">
Require Import Coq.Strings.String.
Eval compute in ("Hello world!"%string).
</syntaxhighlight>
=={{header|Corescript}}==
<syntaxhighlight lang
=={{header|Cowgol}}==
<
print("Hello world!");
print_nl();</
=={{header|Crack}}==
<
import crack.io cout;
cout `Hello world!\n`;
</syntaxhighlight>
=={{header|Craft Basic}}==
<syntaxhighlight lang="basic">print "Hello world!"</syntaxhighlight>
=={{header|Creative Basic}}==
<syntaxhighlight lang="creative basic">
OPENCONSOLE
Line 915 ⟶ 1,335:
END
</syntaxhighlight>
=={{header|Crystal}}==
<
=={{header|Curto}}==
<syntaxhighlight lang="curto">." Hola, mundo!"</syntaxhighlight>
=={{header|D}}==
{{works with|D|2.0}}
<
void main() {
writeln("Hello world!");
}</
=={{header|Dafny}}==
<
method Main() {
print "hello, world!\n";
assert 10 < 2;
}
</syntaxhighlight>
=={{header|Dao}}==
<
=={{header|Dart}}==
<
var bye = 'Hello world!';
print("$bye");
}</
=={{header|DataWeave}}==
<
=={{header|DBL}}==
<syntaxhighlight lang="dbl">;
; Hello world for DBL version 4 by Dario B.
;
PROC
;------------------------------------------------------------------
XCALL FLAGS (0007000000,1)
OPEN (1,O,'TT:')
Line 963 ⟶ 1,386:
CLOSE 1
END</syntaxhighlight>
=={{header|Dc}}==
<syntaxhighlight lang
...or print a numerically represented string.
<syntaxhighlight lang
=={{header|DCL}}==
<
=={{header|DDNC}}==
Line 984 ⟶ 1,406:
The code can be divided into three sections. The first stores the character numbers in order in an array. The second sets up the loop by loading a delay of 500 milliseconds to slot 3, the start address of the character array in memory to slot 2, and the number of times to loop (14) plus one to slot 5. The third section starts the loop of displaying the characters, waiting for the delay time, incrementing the pointer, decrementing the counter, and checking if the counter is negative to know whether to continue the loop.
<
0 111 10
0 15 11
Line 1,014 ⟶ 1,436:
61 4
64
</syntaxhighlight>
=={{header|Delphi}}==
<
program ProjectGoodbye;
{$APPTYPE CONSOLE}
Line 1,023 ⟶ 1,445:
WriteLn('Hello world!');
end.
</syntaxhighlight>
=={{header|DeviousYarn}}==
<
=={{header|DIBOL-11}}==
<syntaxhighlight lang="dibol-11">
START ;Hello World
Line 1,042 ⟶ 1,464:
END
</syntaxhighlight>
=={{header|Diego}}==
Once the caller has met the computer and its printer...
<syntaxhighlight lang="diego">with_computer(comp1)_printer(lp1)_text(Hello World!);</syntaxhighlight>
If the caller is the computer...
<syntaxhighlight lang="diego">with_me()_printer(lp1)_text(Hello World!);</syntaxhighlight>
...or can be shortened as...
<syntaxhighlight lang="diego">me()_ptr(lp1)_txt(Hello World!);</syntaxhighlight>
If the computer has more than one printer...
<syntaxhighlight lang="diego">me()_printer()_text(Hello World!);</syntaxhighlight>
If there are more than one computer which have zero or more printers...
<syntaxhighlight lang="diego">with_computer()_printer()_text(Hello World!);</syntaxhighlight>
If there are zero or more printers connected to any thing (device)...
<syntaxhighlight lang="diego">with_printer()_text(Hello World!);</syntaxhighlight>
=={{header|DIV Games Studio}}==
<
PROGRAM HELLOWORLD;
Line 1,056 ⟶ 1,492:
END
</syntaxhighlight>
=={{header|DM}}==
<syntaxhighlight lang="dm">
/client/New()
..()
src << "Hello world!"
</syntaxhighlight>
=={{header|Draco}}==
<syntaxhighlight lang="draco">proc nonrec main() void:
writeln("Hello world!")
corp</syntaxhighlight>
=={{header|Dragon}}==
<
showln "Hello world!"
</syntaxhighlight>
=={{header|DreamBerd}}==
<syntaxhighlight lang="text">
print "Hello world!"!
</syntaxhighlight>
=={{header|dt}}==
<syntaxhighlight lang="dt">"Hello world!" pl</syntaxhighlight>
=={{header|DWScript}}==
<
PrintLn('Hello world!');
</syntaxhighlight>
=={{header|Dyalect}}==
<
=={{header|Dylan}}==
<syntaxhighlight lang="dylan">
module: hello-world
format-out("%s\n", "Hello world!");
</syntaxhighlight>
=={{header|Dylan.NET}}==
Line 1,093 ⟶ 1,542:
{{works with|.NET|4.5}}
One Line version:
<
Hello World Program:
<syntaxhighlight lang="dylan.net">
//compile using the new dylan.NET v, 11.5.1.2 or later
//use mono to run the compiler
Line 1,113 ⟶ 1,562:
end class
</syntaxhighlight>
=={{header|Déjà Vu}}==
<
=={{header|E}}==
<
stdout.println("Hello world!")</
=={{header|EasyLang}}==
<syntaxhighlight lang="text">
print "Hello world!"
</syntaxhighlight>
=={{header|eC}}==
<
{
void Main()
Line 1,134 ⟶ 1,585:
PrintLn("Hello world!");
}
}</
=={{header|EchoLisp}}==
<
(display "Hello world!" "color:blue")
</syntaxhighlight>
=={{header|ECL}}==
<syntaxhighlight lang="ecl">
OUTPUT('Hello world!');
</syntaxhighlight>
=={{header|Ecstasy}}==
<syntaxhighlight lang="java">
module HelloWorld {
void run() {
@Inject Console console;
console.print("Hello, World!");
}
}
</syntaxhighlight>
=={{header|EDSAC order code}}==
The EDSAC did not support lower-case letters. The method used here is to include a separate <code>O</code> order to print each character: for short messages and labels this is quite adequate. A more general (though slightly more involved) solution for printing strings is given at [[Hello world/Line printer#EDSAC order code]].
<
[ A program for the EDSAC ]
[ Works with Initial Orders 2 ]
Line 1,180 ⟶ 1,641:
DF
EZPF [ Start program beginning at
the load point ]</
{{out}}
<pre>HELLO WORLD</pre>
Line 1,187 ⟶ 1,648:
short version (without a function)
<
complete version (put this in a file and compile it)
<
run = fn () {
io.format("Hello world!~n")
}</
=={{header|Egel}}==
<syntaxhighlight lang="egel">
def main = "Hello World!"
</syntaxhighlight>
=={{header|Egison}}==
<
(define $main
(lambda [$argv]
(write-string "Hello world!\n")))
</syntaxhighlight>
=={{header|EGL}}==
{{works with|EDT}}
{{works with|RBD}}
<syntaxhighlight lang="egl">
program HelloWorld
function main()
Line 1,218 ⟶ 1,679:
end
end
</syntaxhighlight>
=={{header|Eiffel}}==
{{wikipedia|Eiffel (programming language)}}
<
HELLO_WORLD
create
Line 1,231 ⟶ 1,692:
print ("Hello world!%N")
end
end</
=={{header|Ela}}==
<
do putStrLn "Hello world!" ::: IO</
=={{header|Elan}}==
<syntaxhighlight lang="elan">putline ("Hello, world!");</syntaxhighlight>
=={{header|elastiC}}==
From the [http://www.elasticworld.org/man/elastic.html elastiC Manual].
<
// Import the `basic' package
Line 1,257 ⟶ 1,721:
// Invoke the `hello' function
hello();</
=={{header|Elena}}==
ELENA
<
{
console.writeLine
}</
=={{header|Elisa}}==
<
=={{header|Elixir}}==
<
IO.puts "Hello world!"
</syntaxhighlight>
=={{header|Elm}}==
<
=={{header|Emacs Lisp}}==
<syntaxhighlight lang="lisp">(message "Hello world!")</syntaxhighlight>
Alternatively, <code>princ</code> can be used:
<syntaxhighlight lang="lisp">(princ "Hello world!\n")</syntaxhighlight>
=={{header|EMal}}==
<syntaxhighlight lang="emal">writeLine("Hello world!")</syntaxhighlight>
=={{header|Emojicode}}==
<
😀 🔤Hello world!🔤
🍉</
=={{header|Enguage}}==
This shows "hello world", and shows how Enguage can generate this program on-the-fly.
<pre>
On "say hello world", reply "hello world".
## This can be tested:
#] say hello world: hello world.
## This can also be created within Enguage:
#] to the phrase hello reply hello to you too: ok.
#] hello: hello to you too.
</pre>
Output:
<pre>
TEST: hello
===========
user> say hello world.
enguage> hello world.
user> to the phrase hello reply hello to you too.
enguage> ok.
user> hello.
enguage> hello to you too.
1 test group(s) found
+++ PASSED 3 tests in 53ms +++
</pre>
=={{header|Erlang}}==
<
=={{header|ERRE}}==
<syntaxhighlight lang="erre">
! Hello World in ERRE language
PROGRAM HELLO
Line 1,295 ⟶ 1,797:
PRINT("Hello world!")
END PROGRAM
</syntaxhighlight>
=={{header|Euler Math Toolbox}}==
Line 1,305 ⟶ 1,807:
=={{header|Extended BrainF***}}==
<syntaxhighlight lang
=={{header|Ezhil}}==
Line 1,315 ⟶ 1,817:
=={{header|F_Sharp|F#}}==
<
or using .Net classes directly
<
=={{header|Factor}}==
<
=={{header|Falcon}}==
With the printl() function:
<
Or via "fast print":
<
=={{header|FALSE}}==
<
"</
=={{header|Fantom}}==
<
class HelloText
{
Line 1,342 ⟶ 1,844:
}
}
</syntaxhighlight>
=={{header|Fe}}==
<syntaxhighlight lang="clojure">(print "Hello World")</syntaxhighlight>
=={{header|Fennel}}==
<
=={{header|ferite}}==
word.}}
<
Console.println( "Goodby, World!" );</
=={{header|Fermat}}==
<
=={{header|Fexl}}==
<
=={{header|Fhidwfe}}==
<
=={{header|Fish}}==
Standard Hello, world example, modified for this task:
<
>l?!;o</
Explanation of the code:<br/>
<tt>!v"</tt> jumps over the <tt>v</tt> character with the <tt>!</tt> sign, then starts the string mode with <tt>"</tt> .<br/>
Line 1,374 ⟶ 1,878:
=={{header|FOCAL}}==
<
=={{header|Forth}}==
<
Or as a whole program:
<
=={{header|Fortran}}==
Line 1,387 ⟶ 1,891:
Simplest case - display using default formatting:
<
Use explicit output format:
<
print 100,"Hello world!"</
Output to channels other than stdout goes like this:
<
uses the format given at label 100 to output to unit 89. If output unit with this number exists yet (no "<tt>OPEN</tt>" statement or processor-specific external unit setting), a new file will be created and the output sent there. On most UNIX/Linux systems that file will be named "<tt>fort.89</tt>".
Line 1,402 ⟶ 1,906:
=={{header|Fortress}}==
<
run() = println("Hello world!")</
=={{header|FreeBASIC}}==
<
sleep</
=={{header|Free Pascal}}==
<syntaxhighlight lang="pascal">
PROGRAM HelloWorld ;
{$APPTYPE CONSOLE}
(*)
https://www.freepascal.org/advantage.var
(*)
USES
crt;
BEGIN
WriteLn ( 'Hello world!' ) ;
END.
</syntaxhighlight>
=={{header|Frege}}==
Line 1,414 ⟶ 1,942:
{{Works with|Frege|3.20.113}}
<
main _ = println "Hello world!"</
=={{header|friendly interactive shell}}==
Unlike other [[UNIX shell]] languages, fish doesn't support history substitution, so <code>!</code> is safe to use without quoting.
<syntaxhighlight lang
=={{header|Frink}}==
<
println["Hello world!"]
</syntaxhighlight>
=={{header|FTCBASIC}}==
<syntaxhighlight lang="basic">print "Hello, world!"
pause
end</syntaxhighlight>
=={{header|FunL}}==
<
=={{header|Furor}}==
<
=={{header|Peri}}==
<syntaxhighlight lang="peri">
."Hello, World!\n"
</syntaxhighlight>
=={{header|FutureBasic}}==
<syntaxhighlight lang="futurebasic">window 1
print @"Hello world!"
HandleEvents</syntaxhighlight>
=={{header|FUZE BASIC}}==
<
=={{header|Gambas}}==
'''[https://gambas-playground.proko.eu/?gist=d3a51f670e4eb0f793b513b14329be51 Click this link to run this code]'''
<
PRINT "Hello world!"
End</
=={{header|GAP}}==
<
"Hello world!";
Line 1,454 ⟶ 1,998:
f := OutputTextUser();
WriteLine(f, "Hello world!\n");
CloseStream(f);</
=={{header|GB BASIC}}==
<
=={{header|gecho}}==
<
=={{header|Gema}}==
Line 1,466 ⟶ 2,010:
This code will write "Hello world!' no matter what input is given.
<
\B=Hello world!\! ! Start output with this text.</
=={{header|Genie}}==
<syntaxhighlight lang="genie">
init
print "Hello world!"
</syntaxhighlight>
=={{header|Gentee}}==
<
{
print("Hello world!")
}</
=={{header|GFA Basic}}==
<
=={{header|GLBasic}}==
<
=={{header|Gleam}}==
<syntaxhighlight lang="gleam">
import gleam/io
pub fn main() {
io.println("Hello world!")
}
</syntaxhighlight>
=={{header|Glee}}==
<
or
<syntaxhighlight lang
or to display with double quotes
<
or to display with single quotes
<
=={{header|Global Script}}==
This uses the <code>gsio</code> I/O operations, which are designed to be simple to implement on top of Haskell and simple to use.
<syntaxhighlight lang="global
=={{header|GlovePIE}}==
<
=={{header|GML}}==
<
show_debug_message("Hello world!"); // sends text to the debug log or IDE</
=={{header|Go}}==
<
import "fmt"
func main() { fmt.Println("Hello world!") }</
=={{header|Golfscript}}==
<
=={{header|Gosu}}==
<
=={{header|Grain}}==
<syntaxhighlight lang="grain">print("Hello world!")</syntaxhighlight>
=={{header|Groovy}}==
<
=={{header|GW-BASIC}}==
<
=={{header|Hack}}==
<
=={{header|Halon}}==
If the code in run in the REPL the output will be to stdout otherwise syslog LOG_DEBUG will be used.
<
=={{header|Harbour}}==
<
=={{header|Hare}}==
<syntaxhighlight lang="hare">use fmt;
export fn main() void = {
fmt::println("Hello, world!")!;
};</syntaxhighlight>
=={{header|Haskell}}==
<
main = putStrLn "Hello world!"
</syntaxhighlight>
=={{header|Haxe}}==
<
=={{header|hexiscript}}==
<
=={{header|HicEst}}==
<syntaxhighlight lang
=={{header|HLA}}==
<
#include("stdlib.hhf")
begin goodbyeWorld;
Line 1,566 ⟶ 2,129:
stdout.put( "Hello world!" nl );
end goodbyeWorld;</
=={{header|HolyC}}==
<
=={{header|Hoon}}==
<
=={{header|Hopper}}==
<syntaxhighlight lang="csharp">program Hello
{
uses "/Source/Library/Boards/PiPico"
Hopper()
{
WriteLn("Hello world!");
loop
{
LED = !LED;
Delay(500);
}
}
}</syntaxhighlight>
{{out}}
In IDE, build hello.hs into hello.hexe, (press F7) and start debug (F5) or hm console monitor.
<pre>!> hello
Hello world!
</pre>
The language and runtime install verification message shows up on the monitor console. In keeping with most MCU introductions, the onboard Light Emitting Diode (LED) will then blink on and off at 1/2 second intervals, forever; ''(until power runs out, or explicit operator intervention)''.
=={{header|HPPPL}}==
<
=={{header|HQ9+}}==
{{incorrect|HQ9+|output isn't consistent with the task's requirements (and is probably incapable of solving the task).}}
<syntaxhighlight lang
*Technically, HQ9+ can't print "Hello world!" text because of its specification.
- H : Print 'Hello World!'<br>
Line 1,587 ⟶ 2,173:
=={{header|Huginn}}==
<
exec huginn --no-argv -E "${0}" "${@}"
#! huginn
Line 1,594 ⟶ 2,180:
print( "Hello World!\n" );
return ( 0 );
}</
=={{header|HTML5}}==
<syntaxhighlight lang="html5">
<!DOCTYPE html>
<html>
Line 1,603 ⟶ 2,189:
</body>
</html>
</syntaxhighlight>
=={{header|Hy}}==
<
=={{header|i}}==
<
print("Hello world!")
}</
=={{header|Icon}} and {{header|Unicon}}==
<
write( "Hello world!" )
end</
=={{header|IDL}}==
<syntaxhighlight lang
=={{header|Idris}}==
<syntaxhighlight lang="idris">module Main
main : IO ()
main = putStrLn "Hello world!"</syntaxhighlight>
=={{header|Inform 6}}==
<
print "Hello world!^";
];</
=={{header|Inko}}==
<
stdout.print('Hello, world!')</syntaxhighlight>
=={{header|Insitux}}==
<syntaxhighlight lang="insitux">(print "Hello, world!")</syntaxhighlight>
=={{header|Intercal}}==
<syntaxhighlight lang="intercal">DO ,1 <- #13
PLEASE DO ,1 SUB #1 <- #238
DO ,1 SUB #2 <- #108
DO ,1 SUB #3 <- #112
DO ,1 SUB #4 <- #0
DO ,1 SUB #5 <- #64
DO ,1 SUB #6 <- #194
PLEASE DO ,1 SUB #7 <- #48
DO ,1 SUB #8 <- #26
DO ,1 SUB #9 <- #244
PLEASE DO ,1 SUB #10 <- #168
DO ,1 SUB #11 <- #24
DO ,1 SUB #12 <- #16
DO ,1 SUB #13 <- #162
PLEASE READ OUT ,1
PLEASE GIVE UP</syntaxhighlight>
=={{header|Integer BASIC}}==
NOTE: Integer BASIC was written (and hand-assembled by Woz himself) for the Apple 1 and original Apple 2. The Apple 1 has NO support for lower-case letters, and it was an expensive (and later) option on the Apple 2. This example accurately represents the only reasonable solution for those target devices, and therefore cannot be "fixed", only deleted.
<
20 END</
=={{header|Io}}==
<
=={{header|Ioke}}==
<
=={{header|IS-BASIC}}==
<
=={{header|Isabelle}}==
<
imports Main
begin
value ‹''Hello world!''›
end</
=={{header|IWBASIC}}==
<syntaxhighlight lang="iwbasic">
OPENCONSOLE
Line 1,668 ⟶ 2,282:
END
</syntaxhighlight>
=={{header|J}}==
<
Hello world!</
Here are some redundant alternatives:
<
Hello world!
data
Line 1,710 ⟶ 2,324:
Hello world!
Hello world!
</syntaxhighlight>
=={{header|Jack}}==
<
function void main () {
do Output.printString("Hello world!");
Line 1,719 ⟶ 2,333:
return;
}
}</
=={{header|Jacquard Loom}}==
This weaves the string "Hello world!"
<
| |
| * * |
Line 1,809 ⟶ 2,423:
| |
| |
+---------------+</
=={{header|Jai}}==
<syntaxhighlight lang="jai">
#import "Basic";
main :: () {
print("Hello, World!\n");
}
</syntaxhighlight>
=={{header|Jakt}}==
<syntaxhighlight lang="jakt">
fn main() {
println("Hello world!")
}
</syntaxhighlight>
=={{header|Janet}}==
<syntaxhighlight lang="janet">(print "Hello world!")</syntaxhighlight>
=={{header|Java}}==
<
{
public static void main(String[] args)
Line 1,818 ⟶ 2,451:
System.out.println("Hello world!");
}
}</
=={{header|JavaScript}}==
<
{{works with|NJS|0.2.5}}
{{works with|Rhino}}
{{works with|SpiderMonkey}}
<syntaxhighlight lang
{{works with|JScript}}
<
{{works with|Node.js}}
<
=={{header|JCL}}==
<syntaxhighlight lang
=={{header|Jinja}}==
<syntaxhighlight lang="jinja">
from jinja2 import Template
print(Template("Hello World!").render())
</syntaxhighlight>
A bit more convoluted, really using a template:
<syntaxhighlight lang="jinja">
from jinja2 import Template
print(Template("Hello {{ something }}!").render(something="World"))
</syntaxhighlight>
=={{header|Joy}}==
<
=={{header|jq}}==
<
=={{header|JSE}}==
<syntaxhighlight lang="jse">Print "Hello world!"</syntaxhighlight>
=={{header|Jsish}}==
<
=={{header|Julia}}==
<
=={{header|K}}==
<syntaxhighlight lang="k">
"Hello world!"
</syntaxhighlight>
Some of the other ways this task can be attached are:
<syntaxhighlight lang="k">
`0: "Hello world!\n"
</syntaxhighlight>
<syntaxhighlight lang="k">
s: "Hello world!"
s
</syntaxhighlight>
<syntaxhighlight lang="k">
\echo "Hello world!"
</syntaxhighlight>
=={{header|Kabap}}==
<
=={{header|Kaya}}==
<
Void main() {
// My first program!
putStrLn("Hello world!");
}</
=={{header|Kdf9 Usercode}}==
{{incorrect|Kdf9|output isn't consistent with the task's requirements: wording, punctuation.}}
<
V2; W0;
Line 1,889 ⟶ 2,536:
999; OUT;
FINISH;
</syntaxhighlight>
=={{header|Keg}}==
<syntaxhighlight lang
=={{header|Kite}}==
simply a single line
<
"Hello world!"|print;</
=={{header|Kitten}}==
<
=={{header|KL1}}==
<syntaxhighlight lang="prolog>
:- module main.
main :-
unix:unix([stdio(normal(S))]),
S = [fwrite("Hello world\n")].
</syntaxhighlight>
=={{header|Koka}}==
<
println("Hello world!")
}</
Alternatively:
- indentation instead of braces
- uniform function call syntax
- omitted parentheses for function calls with no parameters
<syntaxhighlight lang="koka">fun main()
"Hello world!".println
</syntaxhighlight>
=={{header|KonsolScript}}==
Displays it in a text file or console/terminal.
<
Konsol:Log("Hello world!")
}</
=={{header|Kotlin}}==
<
println("Hello world!")
}</
=={{header|KQL}}==
<syntaxhighlight lang
=={{header|KSI}}==
<syntaxhighlight lang="ksi">
`plain
'Hello world!' #echo #
</syntaxhighlight>
=={{header|Lambdatalk}}==
<
Hello world!
{h1 Hello world!}
_h1 Hello world!\n
</syntaxhighlight>
=={{header|Lang}}==
<syntaxhighlight lang="lang">fn.println(Hello world!)</syntaxhighlight>
=={{header|Lang5}}==
<
=={{header|langur}}==
<
=={{header|Lasso}}==
A plain string is output automatically.
<syntaxhighlight lang
=={{header|LaTeX}}==
<syntaxhighlight lang="latex">\documentclass{minimal}
\begin{document}
Hello World!
\end{document}</syntaxhighlight>
=={{header|Latitude}}==
<
=={{header|LC3 Assembly}}==
<
LEA R0, hello ; R0 = &hello
TRAP x22 ; PUTS (print char array at addr in R0)
HALT
hello .stringz "Hello World!"
.end</
Or (without PUTS)
<
LEA R1, hello ; R1 = &hello
TOP LDR R0, R1, #0 ; R0 = R1[0]
Line 1,971 ⟶ 2,646:
END HALT
hello .stringz "Hello World!"
.end</
=={{header|LDPL}}==
<syntaxhighlight lang="ldpl">
procedure:
display "Hello World!" crlf
</syntaxhighlight>
=={{header|Lean}}==
<syntaxhighlight lang="lean">
#eval "Hello world!"
</syntaxhighlight>
Slightly longer version:
<syntaxhighlight lang="lean">
def main : IO Unit :=
IO.println ("Hello world!")
#eval main
</syntaxhighlight>
=={{header|LFE}}==
<
(: io format '"Hello world!~n")
</syntaxhighlight>
=={{header|Liberty BASIC}}==
<
=={{header|LIL}}==
<
# Hello world in lil
#
print "Hello, world!"</
=={{header|Lily}}==
There are two ways to do this. First, with the builtin print:
<
Second, by using stdout directly:
<
=={{header|Lilypond}}==
<
global = {
\time 4/4
Line 2,014 ⟶ 2,702:
\addlyrics {
Hel -- lo, World!
}</
=={{header|Limbo}}==
<
include "sys.m";
Line 2,030 ⟶ 2,718:
sys = load Sys Sys->PATH;
sys->print("Hello world!\n");
}</
=={{header|Lingo}}==
<
or:
<
=={{header|Lisaac}}==
Line 2,043 ⟶ 2,731:
You can print to standard output in Lisaac by calling STRING.print or INTEGER.print:
<
+ name := GOODBYE; // Define the name of this object.
Section Public
- main <- ("Hello world!\n".print;);</
However, it may be more straightforward to use IO.print_string instead:
<
+ name := GOODBYE2; // Define the name of this object.
Section Public
- main <- (IO.put_string "Hello world!\n";);</
=={{header|Little}}==
Output to terminal:
<
Without the newline terminator:
<
Output to arbitrary open, writable file, for example the standard error channel:
<
=={{header|LiveCode}}==
Line 2,072 ⟶ 2,760:
Text input and output done in the Message palette/window:
<
Present a dialog box to the user
<
Example using command-line livecode-server in shell script
<
set the outputLineEndings to "lf"
put "Hello world!" & return</
Livecode also supports stdout as a device to write to
<
=={{header|LLVM}}==
<
; const char str[14] = "Hello World!\00"
@.str = private unnamed_addr constant [14 x i8] c"Hello, world!\00"
Line 2,098 ⟶ 2,786:
call i32 @puts( i8* getelementptr ([14 x i8]* @str, i32 0,i32 0))
ret i32 0
}</
=={{header|Lobster}}==
<
=={{header|Logo}}==
Print includes a line feed:
<syntaxhighlight lang
Type does not:
<syntaxhighlight lang
=={{header|Logtalk}}==
<
% the initialization/1 directive argument is automatically executed
Line 2,116 ⟶ 2,804:
:- initialization(write('Hello world!\n')).
:- end_object.</
=={{header|LOLCODE}}==
<syntaxhighlight lang="lolcode">
HAI
CAN HAS STDIO?
VISIBLE "Hello world!"
KTHXBYE
</syntaxhighlight>
=={{header|LotusScript}}==
<
'This will send the output to the status bar at the bottom of the Notes client screen
print "Hello world!"
:- end_object.</
=={{header|LSE}}==
<
=={{header|LSE64}}==
<
=={{header|Lua}}==
Function calls with either a string literal or a table constructor passed as their only argument do not require parentheses.
<
Harder way with a table:
<
local chars = {"G","o","o","d","b","y","e",","," ","W","o","r","l","d","!"}
for i = 1, #chars do
io.write(chars[i])
end
-- or:
print(table.concat(chars))
</syntaxhighlight>
=={{header|Luna}}==
<
hello = "Hello, World!"
print hello</
=={{header|M2000 Interpreter}}==
<syntaxhighlight lang="m2000 interpreter">
Print "Hello World!" \\ printing on columns, in various ways defined by last $() for specific layer
Print $(4),"Hello World!" \\ proportional printing using columns, expanded to a number of columns as the length of string indicates.
Report "Hello World!" \\ proportional printing with word wrap, for text, can apply justification and rendering a range of text lines
</syntaxhighlight>
=={{header|M4}}==
For the particular nature of m4, this is simply:
<syntaxhighlight lang
=={{header|MACRO-10}}==
<syntaxhighlight lang="macro-10">
TITLE HELLO
COMMENT !
Hello-World program, PDP-10 assembly language, written by kjx, 2022.
Assembler: MACRO-10 Operating system: TOPS-20
!
SEARCH MONSYM ;Get symbolic names for system-calls.
GO:: RESET% ;System call: Initialize process.
HRROI 1,[ASCIZ /Hello World!/] ;Put pointer to string into register 1.
PSOUT% ;System call: Print string.
HALTF% ;System call: Halt program.
JRST GO ;Unconditional jump to GO (in case the
;user uses the CONTINUE-command while this
;program is still loaded).
END GO
</syntaxhighlight>
=={{header|MACRO-11}}==
<syntaxhighlight lang="macro-11">
;
; TEXT BASED HELLO WORLD
; WRITTEN BY: BILL GUNSHANNON
;
.MCALL .PRINT .EXIT
.RADIX 10
MESG1: .ASCII " "
.ASCII " HELLO WORLD "
.EVEN
START:
.PRINT #MESG1
DONE:
; CLEAN UP AND GO BACK TO KMON
.EXIT
.END START
</syntaxhighlight>
=={{header|Maclisp}}==
<
Or
<
=={{header|MAD}}==
<
PRINT FORMAT HELLO
END OF PROGRAM</
=={{header|make}}==
Makefile contents:
<
all:
$(info Hello world!)
</syntaxhighlight>
Running make produces:
Line 2,190 ⟶ 2,936:
=={{header|Malbolge}}==
'''Long version:'''
<
`CB]V?Tx<uVtT`Rpo3NlF.Jh++FdbCBA@?]!~|4XzyTT43Qsqq(Lnmkj"Fhg${z@></
'''Short version:'''
<
{{Out}}
Line 2,204 ⟶ 2,949:
=={{header|MANOOL}}==
In “applicative” notation:
<
OOPish notation (equivalent to the above, up to Abstract Syntax Tree):
<
LISPish notation (ditto):
<
Using a colon punctuator (ditto):
<
Note that all semicolons, wherever allowed, are optional. The above example with all possible semicolons:
<
=={{header|Maple}}==
<syntaxhighlight lang="maple">
> printf( "Hello world!\n" ): # print without quotes
Hello world!
</syntaxhighlight>
=={{header|Mastermind}}==
<syntaxhighlight lang="mastermind">output "Hello world!\n";</syntaxhighlight>
=={{header|Mathcad}}==
Simply type the following directly onto a Mathcad worksheet (''A worksheet is Mathcad's combined source code file & console'').
<
Applies to Mathcad Prime, Mathcad Prime Express and Mathcad 15 (''and earlier'')
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<
=={{header|MATLAB}}==
<
=={{header|Maude}}==
<syntaxhighlight lang="maude">
fmod BYE-WORLD is
Line 2,245 ⟶ 2,993:
red sayBye .
</syntaxhighlight>
=={{header|Maxima}}==
<
=={{header|MAXScript}}==
<
or:
<
=={{header|MDL}}==
<
<CRLF></
=={{header|MEL}}==
<syntaxhighlight lang="mel">proc helloWorld () {
print "Hello, world!\n";
} </syntaxhighlight>
=={{header|MelonBasic}}==
<syntaxhighlight lang
helloWorld; </syntaxhighlight>
=={{header|Mercury}}==
<
:- interface.
:- import_module io.
Line 2,270 ⟶ 3,025:
:- implementation.
main(!IO) :-
io.write_string("Hello world!\n", !IO).</
=={{header|Metafont}}==
<
=={{header|Microsoft Small Basic}}==
<syntaxhighlight lang="smallbasic">TextWindow.WriteLine("Hello world!")</syntaxhighlight>
=={{header|min}}==
<
=={{header|Minimal BASIC}}==
<syntaxhighlight lang="qbasic">10 PRINT "Hello world!"
20 END</syntaxhighlight>
=={{header|MiniScript}}==
<
=={{header|MiniZinc}}==
<syntaxhighlight lang="minizinc">
output ["Hello World"];
</syntaxhighlight>
{{out}}
<pre>Hello World
----------</pre>
=={{header|MIPS Assembly}}==
{{works with|MARS}} and {{works with|SPIM}}
<
hello: .asciiz "Hello world!" #asciiz automatically adds the null terminator. If it's .ascii it doesn't have it.
Line 2,303 ⟶ 3,063:
li $v0, 10 # set the syscall to exit
syscall # make the system call</
=={{header|Miranda}}==
<syntaxhighlight lang="miranda">main :: [sys_message]
main = [Stdout "Hello, world!\n"]</syntaxhighlight>
=={{header|mIRC Scripting Language}}==
<syntaxhighlight lang
=={{header|ML/I}}==
<syntaxhighlight lang
=={{header|Modula-2}}==
<
IMPORT InOut;
Line 2,318 ⟶ 3,082:
InOut.WriteString('Hello world!');
InOut.WriteLn
END Hello.</
==={{header|TopSpeed Modula-2}}===
{{works with|TopSpeed (JPI) Modula-2 under DOSBox-X}}
Modula-2 does not have built-in procedures for I/O. Instead, I/O is done via library modules. The names and contents of these modules vary between implementations of Modula-2. The solution below shows that the console I/O module supplied with TopSpeed Modula-2 has a different name and different procedures from the implementation in the previous solution.
<syntaxhighlight lang="modula2">
MODULE Hello;
IMPORT IO;
BEGIN
IO.WrStr('Hello world!'); IO.WrLn;
(* Another way, showing some features of Modula-2 *)
IO.WrStr("Hello"); (* either single or double quotes can be used *)
IO.WrChar(40C); (* character whose ASCII code is 40 octal *)
IO.WrStr('world!');
IO.WrLn(); (* procedure with no arguments: () is optional *)
END Hello.
</syntaxhighlight>
=={{header|Modula-3}}==
<
IMPORT IO;
Line 2,327 ⟶ 3,108:
BEGIN
IO.Put("Hello world!\n");
END Goodbye.</
=={{header|MontiLang}}==
<syntaxhighlight lang
=={{header|Morfa}}==
<
import morfa.io.print;
func main(): void
Line 2,339 ⟶ 3,120:
println("Hello world!");
}
</syntaxhighlight>
=={{header|Mosaic}}==
<
end</
Or just:
<syntaxhighlight lang="mosaic">
println "Hello, world"</syntaxhighlight>
=={{header|MSX Basic}}==
<syntaxhighlight lang="qbasic">10 PRINT "Hello world!"</syntaxhighlight>
=={{header|MUF}}==
<
me @ "Hello world!" notify
exit
;</
=={{header|MUMPS}}==
<
=={{header|MyDef}}==
Run with: <pre>mydef_run hello.def</pre>
Perl:
<syntaxhighlight lang
C:
<syntaxhighlight lang="mydef">
module: c
$print Hello world
</syntaxhighlight>
python:
<syntaxhighlight lang="mydef">
module: python
$print Hello world
</syntaxhighlight>
JavaScript
<syntaxhighlight lang="mydef">
module: js
$print "Hello world"
</syntaxhighlight>
go:
<syntaxhighlight lang="mydef">
module: go
$print Hello world
</syntaxhighlight>
=={{header|MyrtleScript}}==
<
func main returns: int {
print("Hello World!")
}
}
</syntaxhighlight>
=={{header|MySQL}}==
<syntaxhighlight lang
=={{header|Mythryl}}==
<
=={{header|N/t/roff}}==
Line 2,406 ⟶ 3,194:
Because /.ROFF/ is a document formatting language, the majority of input is expected to be text to output onto a medium. Therefore, there are no routines to explicitly call to print text.
<syntaxhighlight lang
=={{header|Nanoquery}}==
<
=={{header|Neat}}==
<
=={{header|Neko}}==
<
=={{header|Nemerle}}==
<syntaxhighlight lang="nemerle">
class Hello
{
Line 2,427 ⟶ 3,215:
}
}
</syntaxhighlight>
Easier method:
<syntaxhighlight lang="nemerle">
System.Console.WriteLine("Hello world!");
</syntaxhighlight>
=={{header|NetRexx}}==
<syntaxhighlight lang
=={{header|Never}}==
<
prints("Hello world!\n");
0
}</
{{out}}
Line 2,448 ⟶ 3,236:
=={{header|newLISP}}==
{{works with|newLisp|6.1 and after}}
<
=={{header|Nickle}}==
<
=={{header|Nim}}==
<
using <code>stdout</code>
<syntaxhighlight lang="nim">stdout.writeLine("Hello World!")</syntaxhighlight>
=={{header|Nit}}==
<
=={{header|Nix}}==
<syntaxhighlight lang="nix">"Hello world!"</syntaxhighlight>
=={{header|NLP++}}==
<syntaxhighlight lang="nlp++">
@CODE
"output.txt" << "Hello world!";
@@CODE
</syntaxhighlight>
=={{header|NS-HUBASIC}}==
<p>As lowercase characters are not offered in NS-HUBASIC, perhaps some flexibility in the task specification could be offered.</p>
Using <code>?</code>:
<
Using <code>PRINT</code>:
<
=={{header|Nu}}==
<syntaxhighlight lang="nu">
print "Hello world!"
</syntaxhighlight>
=={{header|Nutt}}==
<syntaxhighlight lang="Nutt">
module hello_world
imports native.io.output.say
say("Hello, world!")
end
</syntaxhighlight>
=={{header|Nyquist}}==
Line 2,471 ⟶ 3,285:
[[Category:Nyquist Version 3.15]]
===LISP syntax===
<
Or
<
===SAL syntax===
<
Or
<
=={{header|Oberon-2}}==
<
MODULE Goodbye;
IMPORT Out;
Line 2,495 ⟶ 3,309:
World;
END Goodbye.
</syntaxhighlight>
=={{header|Objeck}}==
<
class Hello {
function : Main(args : String[]) ~ Nil {
"Hello world!"->PrintLine();
}
}</
=={{header|ObjectIcon}}==
<syntaxhighlight lang="objecticon">
import io
procedure main ()
io.write ("Hello world!")
end
</syntaxhighlight>
{{out}}
<pre>$ oiscript hello-OI.icn
Hello world!</pre>
=={{header|Objective-C}}==
Line 2,510 ⟶ 3,337:
The de facto Objective-C "Hello, World!" program is most commonly illustrated as the following, using the NSLog() function:
<
#import <Foundation/Foundation.h>
Line 2,518 ⟶ 3,345:
}
}
</syntaxhighlight>
However the purpose of the NSLog() function is to print a message to standard error prefixed with a timestamp, which does not meet the most common criteria of a "Hello, World!" program of displaying only the requested message to standard output.
Line 2,524 ⟶ 3,351:
The following code prints the message to standard output without a timestamp using exclusively Objective-C messages:
<
#import <Foundation/Foundation.h>
Line 2,534 ⟶ 3,361:
}
}
</syntaxhighlight>
Objective-C also supports functions contained within the C standard library. However, Objective-C's NSString objects must be converted into a UTF-8 string in order to be supported by the C language's I/O functions.
<
#import <Foundation/Foundation.h>
Line 2,547 ⟶ 3,374:
}
}
</syntaxhighlight>
=={{header|OCaml}}==
<
=={{header|Occam}}==
{{works with|kroc}}
<
PROC main (CHAN BYTE screen!)
out.string("Hello world!*c*n", 0, screen)
:</
=={{header|Octave}}==
<
Or, using C-style function printf:
<
=={{header|Odin}}==
<syntaxhighlight lang="odin">package main
import "core:fmt"
main :: proc() {
fmt.println("Hellope!");
}</syntaxhighlight>
=={{header|Oforth}}==
<
=={{header|Ol}}==
<
=={{header|Onyx}}==
<
=={{header|Onyx (wasm)}}==
<syntaxhighlight lang="TS">
use core {printf}
main :: () {
printf("Hello world!");
}
</syntaxhighlight>
{{out}}
<pre>
Hello world!
</pre>
=={{header|OOC}}==
To print a String, either call its println() method:
<
"Hello world!" println()
}</
Or call the free println() function with the String as the argument.
<
println("Hello world!")
}</
=={{header|ooRexx}}==
Refer also to the [[#REXX|Rexx]] and [[#NetRexx|NetRexx]] solutions. Simple output is common to most Rexx dialects.
<
say 'Hello world!'
</syntaxhighlight>
=={{header|OpenLisp}}==
We can use the same code as the Common Lisp example, but as a shell script.
<
#!/openlisp/uxlisp -shell
(format t "Hello world!~%")
(print "Hello world!")
</syntaxhighlight>
Output:
Line 2,604 ⟶ 3,451:
=={{header|Openscad}}==
<
echo("Hello world!"); // writes to the console
text("Hello world!"); // creates 2D text in the object space
linear_extrude(height=10) text("Hello world!"); // creates 3D text in the object space
</syntaxhighlight>
=={{header|Owl Lisp}}==
<syntaxhighlight lang="scheme">
(print "Hello world!")
</syntaxhighlight>
{{out}}
<pre>$ ol hello-Owl.scm
Hello world!</pre>
=={{header|Oxygene}}==
From [[wp:Oxygene (programming language)]]
<syntaxhighlight lang="pascal">
namespace HelloWorld;
Line 2,627 ⟶ 3,484:
class method HelloClass.Main;
begin
end;
end.
</syntaxhighlight>
{{out}}
<pre>
Hello world!
</pre>
=={{header|Oz}}==
<
=={{header|PARI/GP}}==
<
=={{header|Pascal}}==
{{works with|Free Pascal}}
<
begin
writeln('Hello world!');
end.</
=={{header|PascalABC.NET}}==
<syntaxhighlight lang="pascal">
// Hello world/Text. Nigel Galloway: January 25th., 2023
begin
System.Console.WriteLine('Hello World!');
end.
</syntaxhighlight>
{{out}}
<pre>
Hello World!
</pre>
=={{header|PASM}}==
<
end</
=={{header|PDP-1 Assembly}}==
This can be assembled with macro1.c distributed with SIMH and then run on the SIMH PDP-1 simulator.
<
hello
/ above: title line - was punched in human readable letters on paper tape
Line 2,677 ⟶ 3,545:
end, . / sentinel for end of message
start 100 / tells assembler where program starts
</syntaxhighlight>
=={{header|PDP-11 Assembly}}==
Line 2,684 ⟶ 3,552:
{{works with|UNIX|1}} to {{works with|UNIX|7}}
<
.text
start:
Line 2,694 ⟶ 3,562:
.data
outtext: <Hello world!\n>
outlen = . - outtext</
=={{header|Pebble}}==
<syntaxhighlight lang="pebble">;Hello world example program
;for x86 DOS
;compile with Pebble
;compiled com program is 51 bytes
program examples\hello
begin
echo "Hello, world!"
pause
kill
end</syntaxhighlight>
=={{header|PepsiScript}}==
Line 2,700 ⟶ 3,585:
For typing:
<
#author Childishbeat
Line 2,709 ⟶ 3,594:
print "Hello world!"
end</
For importing:
Line 2,716 ⟶ 3,601:
=={{header|Perl}}==
{{works with|Perl|5.8.8}}
<
{{works with|Perl|5.10.x}}
Backported from Raku:
<
say 'Hello world!';</
or:
<
say 'Hello world!';</
=={{header|Peylang}}==
<syntaxhighlight lang="peylang">chaap 'Hello world!';</syntaxhighlight>
{{out}}
<pre>
$ peyman hello.pey
Hello world!
</pre>
=={{header|Pharo}}==
<
"Sending message printString to 'Hello World' string"
'Hello World' printString</
=={{header|Phix}}==
{{libheader|Phix/basics}}
<!--<
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #008000;">"Hello world!"</span><span style="color: #0000FF;">)</span>
<!--</
=={{header|PHL}}==
<
extern printf;
Line 2,746 ⟶ 3,639:
printf("Hello world!");
return 0;
]</
=={{header|PHP}}==
<
echo "Hello world!\n";
?></
Alternatively, any text outside of the <code><?php ?></code> tags will be automatically echoed:
<syntaxhighlight lang
=={{header|Picat}}==
<syntaxhighlight lang="picat">println("Hello, world!")</syntaxhighlight>
=={{header|PicoLisp}}==
<
=={{header|Pict}}==
Using the syntax sugared version:
<
Using the channel syntax:
<
run ( prNL!["Hello World!" (rchan done)]
| done?_ = () )</
=={{header|Pikachu}}==
<
pikachu pikachu pi pikachu
pikachu pika pika pikachu pika pikachu pikachu pika pika pikachu pikachu pi pi pikachu pika pikachu pika pika pi pika pikachu pikachu pi pika pika pikachu pi pika pi pika pi pikachu pi pikachu pika pika pi pi pika pi pika pika pikachu pikachu pika pikachu pikachu pika pi pikachu pika pi pikachu pi pika pika pi pikachu pika pi pika pikachu pi pi pikachu pika pika pi pika pi pikachu
Line 2,789 ⟶ 3,685:
pikachu pi pi pika pi pi pikachu pika pikachu pikachu pika pika pi pi pika pikachu pi pikachu pi pi pika pi pika pi pi pika pikachu pi pika pi pikachu pika pikachu pika pi pi pika pi pi pikachu pi pikachu pikachu pika pi pikachu pi pi pika pi pikachu pi pi pika pi pi pikachu pika pikachu pika pikachu pika pi pikachu pikachu pi pi pika pika pikachu
pikachu pikachu pi pikachu
pikachu pikachu pika pikachu</
=={{header|Pike}}==
<
write("Hello world!\n");
}</
=={{header|PILOT}}==
<syntaxhighlight lang
=={{header|PIR}}==
<
print "Hello world!\n"
.end</
=={{header|Pixilang}}==
<
=={{header|PL/I}}==
<
put list('Hello world!');
end goodbye;</
=={{header|PL/M}}==
The original PL/M compiler does not recognise lower-case letters, hence the Hello, World! string must specify the ASCII codes for the lower-case letters.
<syntaxhighlight lang="pli">100H:
PRINT$STRING: PROCEDURE( S ); DECLARE S ADDRESS; CALL BDOS( 9, S ); END;
/* HELLO, WORLD! IN MIXED CASE */
DECLARE HELLO$WORLD ( 14 ) BYTE
INITIAL( 'H', 65H, 6CH, 6CH, 6FH, ',', ' '
, 'W', 6FH, 72H, 6CH, 64H, 21H, '$'
);
CALL PRINT$STRING( .HELLO$WORLD );
EOF</syntaxhighlight>
=={{header|PL/SQL}}==
{{works with|Oracle}}
<
set serveroutput on
Line 2,833 ⟶ 3,732:
END;
/
</syntaxhighlight>
<pre>
Line 2,848 ⟶ 3,747:
=={{header|Plain English}}==
<
\...and backslashes are comments!
To run:
Line 2,854 ⟶ 3,753:
Write "Hello World!" to the console.
Wait for the escape key.
Shut down.</
=={{header|Plan}}==
This prints HELLO WORLD on operator's console.
<
#PROGRAM HLWD
#LOWER
Line 2,870 ⟶ 3,769:
#END
#FINISH
#STOP</
=={{header|Pointless}}==
<syntaxhighlight lang="pointless">
output = println("Hello world!")
</syntaxhighlight>
=={{header|Pony}}==
<
new create(env: Env) =>
env.out.print("Hello world!")</
=={{header|Pop11}}==
<
=={{header|Portugol}}==
Portugol keywords are Portuguese words.
<syntaxhighlight lang="portugol">
programa {
// funcao defines a new function
// inicio is the entry point of the program, like main in C
funcao inicio() {
// escreva is used to print stuff to the screen
escreva("Hello, world!\n") // no ';' needed
}
}
</syntaxhighlight>
=={{header|PostScript}}==
Line 2,884 ⟶ 3,801:
To generate a document that shows the text "Hello world!":
<
/Helvetica 20 selectfont
70 700 moveto
(Hello world!) show
showpage</
If the viewer has a console, then there are the following ways to display the topmost element of the stack:
<
will display the <i>string</i> "(Hello world!)";
<
will display the <i>content</i> of the string "(Hello world!)"; that is, "Hello world!";
<syntaxhighlight lang
will do the same, without printing a newline. It may be necessary to provoke an error message to make the console pop up. The following program combines all four above variants:
<
/Helvetica 20 selectfont
70 700 moveto
Line 2,911 ⟶ 3,828:
show % prints to document
1 0 div % provokes error message
showpage</
=={{header|Potion}}==
<
=={{header|PowerBASIC}}==
<
#COMPILER PBCC 6
Line 2,923 ⟶ 3,840:
CON.PRINT "Hello world!"
CON.WAITKEY$
END FUNCTION</
=={{header|PowerShell}}==
Line 2,929 ⟶ 3,846:
See http://www.jsnover.com/blog/2013/12/07/write-host-considered-harmful/ (Jeffrey Snover is one of the creators of PowerShell).
<syntaxhighlight lang
=={{header|Processing}}==
<
=={{header|ProDOS}}==
<syntaxhighlight lang
=={{header|Programming Language}}==
For typing:
<syntaxhighlight lang="programming
For importing:
Line 2,945 ⟶ 3,862:
=={{header|Prolog}}==
<
=={{header|PROMAL}}==
<syntaxhighlight lang="promal">
program hello
include library
begin
output "Hello world!"
end
</syntaxhighlight>
=={{header|PSQL}}==
Line 2,957 ⟶ 3,883:
=={{header|Pure}}==
<
using system;
puts "Hello world!\n" ;
</syntaxhighlight>
=={{header|PureBasic}}==
<
PrintN("Hello world!")
Input() ; Wait for enter</
using <code>Debug</code>
<syntaxhighlight lang="purebasic">Debug("Hello world!")</syntaxhighlight>
=={{header|Python}}==
{{works with|Python|2.4}}
<
The same using sys.stdout
<
sys.stdout.write("Hello world!\n")</
In Python 3.0, print is changed from a statement to a function.
{{works with|Python|3.0}} (And version 2.X too).
<
'''An easter egg'''
The first two examples print <code>Hello, world!</code> once, and the last one prints it twice.
<syntaxhighlight lang
<syntaxhighlight lang
<syntaxhighlight lang
=={{header|QB64}}==
<
=={{header|Quackery}}==
<
=={{header|Quill}}==
<
=={{header|Quite BASIC}}==
<
=={{header|R}}==
<
or
<
or
<
=={{header|Ra}}==
<syntaxhighlight lang="ra">
class HelloWorld
**Prints "Hello world!"**
Line 3,016 ⟶ 3,944:
print "Hello world!"
</syntaxhighlight>
=={{header|Racket}}==
<syntaxhighlight lang="racket">
(printf "Hello world!\n")
</syntaxhighlight>
=={{header|Raku}}==
(formerly Perl 6)
<syntaxhighlight lang="raku"
In an object-oriented approach, the string is treated as an object calling its '''say()''' method:
<syntaxhighlight lang="raku"
=={{header|Raven}}==
<syntaxhighlight lang
=={{header|RATFOR}}==
<syntaxhighlight lang="ratfor">
program hello
write(*,101)"Hello World"
101 format(A)
end
</syntaxhighlight>
=={{header|RASEL}}==
<syntaxhighlight lang="text">A"!dlroW ,olleH">:?@,Hj</syntaxhighlight>
=={{header|REALbasic}}==
Line 3,036 ⟶ 3,980:
This requires a console application.
<
Print "Hello world!"
Quit
End Function</
=={{header|REBOL}}==
<
=={{header|RED}}==
<
=={{header|
<syntaxhighlight lang="refal">$ENTRY Go {
= <Prout 'Hello, world!'>;
};</syntaxhighlight>
=={{header|Relation}}==
<syntaxhighlight lang="relation">
' Hello world!
</syntaxhighlight>
=={{header|ReScript}}==
<syntaxhighlight lang="rescript">Js.log("Hello world!")</syntaxhighlight>
{{out}}
<pre>
$ bsc hello.res > hello.bs.js
$ node hello.bs.js
Hello world!
</pre>
=={{header|Retro}}==
<syntaxhighlight lang="retro">
'Hello_world! s:put
</syntaxhighlight>
=={{header|REXX}}==
===using SAY===
<
say 'Hello world!'</
===using SAY variable===
<
yyy = 'Hello world!'
say yyy</
===using LINEOUT===
<
call lineout ,"Hello world!"</
=={{header|Rhovas}}==
<syntaxhighlight lang="360 assembly">
print("Hello world!");
</syntaxhighlight>
=={{header|Ring}}==
<
=={{header|
<
hello:
.string "Hello World!\n\0"
Line 3,088 ⟶ 4,053:
li a7, 10
ecall
</syntaxhighlight>
=={{header|Roc}}==
<syntaxhighlight lang="roc">app "hello"
packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.1.1/zAoiC9xtQPHywYk350_b7ust04BmWLW00sjb9ZPtSQk.tar.br" }
imports [pf.Stdout]
provides [main] to pf
main =
Stdout.line "I'm a Roc application!"
</syntaxhighlight>
=={{header|Rockstar}}==
<syntaxhighlight lang="rockstar">Shout "Hello world!"</syntaxhighlight>
=={{header|RPG}}==
<nowiki>**</nowiki>free<br>
dsply 'Hello World!';
=={{header|RPL}}==
≪ "Hello world!" 1 DISP
1 FREEZE <span style="color:grey">@ remove this line on HP-28 models</span>
≫ '<span style="color:blue">TASK</span>' STO
=={{header|RTL/2}}==
<
LET NL=10;
Line 3,102 ⟶ 4,089:
RETURN(1);
ENDPROC;</
=={{header|Ruby}}==
{{works with|Ruby|1.8.4}}
<
or
<
or even
<
'''Using the > global'''
<
<
=={{header|Run BASIC}}==
<
=={{header|Rust}}==
<
fn main() {
print!("Hello world!");
}
</syntaxhighlight>
or
<
fn main() {
println!("Hello world!");
}
</syntaxhighlight>
=={{header|Salmon}}==
<
or
<
or
<
=={{header|SAS}}==
<
data _null_;
put "Hello world!";
run;</
=={{header|SASL}}==
Note that a string starts with a single and ends with a double quote
<syntaxhighlight lang="sasl">
'Hello World!",nl
</syntaxhighlight>
=={{header|Sather}}==
<
main is
#OUT+"Hello world!\n";
end;
end;</
=={{header|Scala}}==
Line 3,169 ⟶ 4,156:
===Ad hoc REPL solution===
Ad hoc solution as [http://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop REPL] script. Type this in a REPL session:
<
===Via Java runtime===
This is a call to the Java run-time library. '''Not recommended'''.
<
===Via Scala Console API===
This is a call to the Scala run-time library. '''Recommended'''.
<
===Short term deviation to out===
<
===Long term deviation to out===
<
Console.setErr(Console.out)
Console.err.println ("Err deviated")
Console.setErr(Console.err) // Reset to normal</
=={{header|Scheme}}==
All Scheme implementations display the value of the last evaluated expression before the program terminates.
<
The <tt>display</tt> and <tt>newline</tt> procedures are found in specific modules of the standard library in R6RS and R7RS.
Line 3,194 ⟶ 4,181:
===R5RS===
<
(newline)</
===R6RS===
<
(rnrs io simple (6)))
(display "Hello world!")
(newline)</
===R7RS===
<
(scheme write))
(display "Hello world!")
(newline)</
=={{header|Scilab}}==
<
=={{header|ScratchScript}}==
<
This example waits until the mouse is clicked for the program to end. This can be useful if the program executes too fast for "Hello world!" to be visible on the screen long enough for it to be comfortable.
<
delayOnClick</
=={{header|sed}}==
<
Hello world!
q</
=={{header|Seed7}}==
<
const proc: main is func
begin
writeln("Hello world!");
end func;</
=={{header|Self}}==
<syntaxhighlight lang
=={{header|SenseTalk}}==
<
=={{header|Set lang}}==
<
set ! E
set ! L
Line 3,249 ⟶ 4,236:
set ! L
set ! D
set ! 33</
=={{header|SETL}}==
<
=={{header|SETL4}}==
<
=={{header|Shen}}==
<
=={{header|Shiny}}==
<syntaxhighlight lang
=={{header|Sidef}}==
<syntaxhighlight lang
=={{header|SimpleCode}}==
The letters are only outputted in uppercase in the running program. However, lowercase characters can be used in the code instead.
<syntaxhighlight lang="simplecode">dtxt
Hello world!</
=={{header|SIMPOL}}==
<
end function "Hello world!{d}{a}"</
=={{header|Simula}}==
{{works with|SIMULA-67}}
<
OUTTEXT("Hello world!");
OUTIMAGE
END</
=={{header|Sing}}==
<syntaxhighlight lang="sing">requires "sio";
public fn singmain(argv [*]string) i32
{
sio.print("hello world !\r\n");
return(0);
}</syntaxhighlight>
=={{header|Sisal}}==
<
% Sisal doesn't yet have a string built-in.
Line 3,292 ⟶ 4,288:
function main(returns string)
"Hello world!"
end function</
=={{header|Skew}}==
{{works with|skewc|0.9.19}}
<syntaxhighlight lang="skew">
@entry
def main {
dynamic.console.log("Hello world!")
}
</syntaxhighlight>
=={{header|SkookumScript}}==
<
Alternatively if just typing in the SkookumIDE [http://skookumscript.com/docs/v3.0/ide/console/workspace/ REPL]:
<
=={{header|Slate}}==
<syntaxhighlight lang
=={{header|Slope}}==
<syntaxhighlight lang="slope">(write "Hello, world!")</syntaxhighlight>
=={{header|SmallBASIC}}==
<syntaxhighlight lang="smallbasic">PRINT "Hello world!"</syntaxhighlight>
=={{header|Smalltalk}}==
<
{{works with|GNU Smalltalk}} (as does the above code)
<syntaxhighlight lang
=={{header|smart BASIC}}==
<
=={{header|SmileBASIC}}==
<
=={{header|SNOBOL4}}==
Using CSnobol4 dialect
<
END</
=={{header|SNUSP}}==
===Core SNUSP===
<
\+++\ | /+>+++++++>/ /++++++++++<<.++>./
$+++/ | \+++++++++>\ \+++++.>.+++.-----\
\==-<<<<+>+++/ /=.>.+>.--------.-/</
===Modular SNUSP===
<
| | \@------|# | \@@+@@++|+++#- \\ -
| \@@@@=+++++# | \===--------!\===!\-----|-------#-------/
\@@+@@@+++++# \!#+++++++++++++++++++++++#!/</
=={{header|Soda}}==
<syntaxhighlight lang="soda">
class Main
main (arguments : Array [String] ) : Unit =
println ("Hello world!")
end
</syntaxhighlight>
=={{header|SoneKing Assembly}}==
<
extern print
Line 3,342 ⟶ 4,364:
call print
pop
</syntaxhighlight>
=={{header|SPARC Assembly}}==
<
.section ".text"
.global _start
Line 3,362 ⟶ 4,384:
.ascii "Hello world!\n"
.msgend:
</syntaxhighlight>
=={{header|Sparkling}}==
<
=={{header|SPL}}==
<
=={{header|SQL}}==
{{works with|Oracle}}
{{works with|Db2 LUW}}
<
select 'Hello world!' text from dual;
</syntaxhighlight>
<pre>
Line 3,387 ⟶ 4,409:
{{works with|Db2 LUW}}
With SQL only:
<
SELECT 'Hello world!' AS text FROM sysibm.sysdummy1;
</syntaxhighlight>
Output:
<pre>
Line 3,404 ⟶ 4,426:
{{works with|Db2 LUW}} version 9.7 or higher.
With SQL PL:
<
SET SERVEROUTPUT ON;
CALL DBMS_OUTPUT.PUT_LINE('Hello world!');
</syntaxhighlight>
Output:
<pre>
Line 3,422 ⟶ 4,444:
=={{header|Standard ML}}==
<
=={{header|Stata}}==
<
=={{header|Suneido}}==
<
=={{header|Swahili}}==
<
=={{header|Swift}}==
{{works with|Swift|2.x+}}
<
{{works with|Swift|1.x}}
<
=={{header|Symsyn}}==
<
'hello world' []
</syntaxhighlight>
=={{header|TailDot}}==
<syntaxhighlight lang=taildot>c,x,Hello World!,v,x</syntaxhighlight>
=={{header|Tailspin}}==
<
=={{header|Tcl}}==
Output to terminal:
<
Output to arbitrary open, writable file:
<syntaxhighlight lang
=={{header|Teco}}==
Outputting to terminal. Please note that ^A means control-A, not a caret followed by 'A', and that $ represent the ESC key.
<syntaxhighlight lang
=={{header|Tern}}==
<
=={{header|Terra}}==
<
terra hello(argc : int, argv : &rawstring)
C.printf("Hello world!\n")
return 0
end</
=={{header|Terraform}}==
<
value = "Hello world!"
}</
{{Out}}
<pre>$ terraform init
Line 3,486 ⟶ 4,509:
=={{header|TestML}}==
<
Print("Hello world!")</
=={{header|TI-57}}==
0.7745
You must then turn the calculator upside down to read the text: [https://aerobarfilms.files.wordpress.com/2023/04/ti-57-hello-world-1.jpg screenshot]
=={{header|TI-83 BASIC}}==
<
(Lowercase letters DO exist in TI-BASIC, though you need an assembly program to enable them.)
=={{header|TI-89 BASIC}}==
<
=={{header|Tiny BASIC}}==
{{works with|TinyBasic}}
<syntaxhighlight lang="basic">
10 PRINT "Hello, World!"
20 END
</syntaxhighlight>
=={{header|TMG}}==
Unix TMG:
<
=={{header|TorqueScript}}==
<
=={{header|TPP}}==
<syntaxhighlight lang
=={{header|Transact-SQL}}==
<
=={{header|Transd}}==
<
=={{header|TransFORTH}}==
<
=={{header|Trith}}==
<
=={{header|True BASIC}}==
<
! In True BASIC all programs run in their own window. So this is almost a graphical version.
PRINT "Hello world!"
END
</syntaxhighlight>
=={{header|TUSCRIPT}}==
<
$$ MODE TUSCRIPT
PRINT "Hello world!"
</syntaxhighlight>
Output:
<pre>
Line 3,542 ⟶ 4,571:
</pre>
=={{header|uBasic/4tH}}==
<syntaxhighlight lang="text">Print "Hello world!"</syntaxhighlight>
=={{header|Uniface}}==
<syntaxhighlight lang="uniface">
message "Hello world!"
</syntaxhighlight>
=={{header|Unison}}==
<syntaxhighlight lang="unison">
main = '(printLine "Hello world!")
</syntaxhighlight>
=={{header|UNIX Shell}}==
{{works with|Bourne Shell}}
<
echo "Hello world!"</
==={{header|C Shell}}===
<
echo "Hello world!\!"</
We use \! to prevent history substitution. Plain ! at end of string seems to be safe, but we use \! to be sure.
=={{header|Unlambda}}==
<
=={{header|Ursa}}==
<
=={{header|Ursala}}==
output as a side effect of compilation
<
main = -[Hello world!]-</
output by a compiled executable
<
#executable ('parameterized','')
main = <file[contents: -[Hello world!]-]>!</
=={{header|Ursalang}}==
<syntaxhighlight lang="ursa">print("hello woods!")</syntaxhighlight>
=={{header|உயிர்/Uyir}}==
<
("உலகத்தோருக்கு வணக்கம்") என்பதை திரை.இடு;
முதன்மை = 0;
}};</
=={{header|Uxntal}}==
<syntaxhighlight lang="Uxntal">
( hello-world.tal )
|00 @System [ &vector $2 &wst $1 &rst $1 &eaddr $2 &ecode $1 &pad $1 &r $2 &g $2 &b $2 &debug $1 &halt $1 ]
|10 @Console [ &vector $2 &read $1 &pad $5 &write $1 &error $1 ]
( program )
|0100 @on-reset ( -> )
;hello print-str
HALT
BRK
@print-str ( str* -- )
&while
LDAk .Console/write DEO
INC2 LDAk ?&while
POP2
JMP2r
@HALT ( -- )
#01 .System/halt DEO
JMP2r
@hello "Hello 20 "world! 0a 00
</syntaxhighlight>
=={{header|V}}==
<
=={{header|Vala}}==
<
stdout.printf("Hello world!\n");
}</
=={{header|Vale}}==
{{works with|Vale|0.2.0}}
<syntaxhighlight lang="vale">
import stdlib.*;
exported func main() {
println("Hello world!");
}
</syntaxhighlight>
=={{header|VAX Assembly}}==
<syntaxhighlight lang="vax assembly">
desc: .ascid "Hello World!" ;descriptor (len+addr) and text
.entry hello, ^m<> ;register save mask
Line 3,605 ⟶ 4,675:
ret ;restore registers, clean stack & return
.end hello ;transfer address for linker
</syntaxhighlight>
=={{header|VBA}}==
<syntaxhighlight lang="vb">
Public Sub hello_world_text
Debug.Print "Hello World!"
End Sub
</syntaxhighlight>
=={{header|VBScript}}==
{{works with|Windows Script Host|5.7}}
<
=={{header|Vedit macro language}}==
<
=={{header|Verbexx}}==
<
=={{header|Verilog}}==
<syntaxhighlight lang="verilog">
module main;
initial begin
$display("Hello world!");
$finish ;
end
endmodule
</syntaxhighlight>
=={{header|VHDL}}==
<
USE std.TEXTIO.all;
Line 3,633 ⟶ 4,722:
wait; -- needed to stop the execution
end process;
end architecture beh;</
=={{header|Vim Script}}==
<
=={{header|Visual Basic}}==
Line 3,642 ⟶ 4,731:
{{works with|Visual Basic|VB6 Standard}}
Visual Basic 6 is actually designed to create GUI applications, however with a little help from the Microsoft.Scripting Library it is fairly easy to write a simple console application.
<
Private Declare Function AllocConsole Lib "kernel32.dll" () As Long
Line 3,660 ⟶ 4,749:
mStdIn.Read 1
Call FreeConsole
End Sub</
=={{header|Visual Basic .NET}}==
<
Module HelloWorld
Line 3,669 ⟶ 4,758:
Console.WriteLine("Hello world!")
End Sub
End Module</
=={{header|Viua VM assembly}}==
<syntaxhighlight lang="text">.function: main/0
text %1 local "Hello World!"
print %1 local
izero %0 local
return
.end</
=={{header|V (Vlang)}}==
<
println('Hello World!')
}</
=={{header|VTL-2}}==
<syntaxhighlight lang="vtl-2">10 ?="Hello world!"</syntaxhighlight>
=={{header|Waduzitdo}}==
<syntaxhighlight lang="waduzitdo">T:Hello world!
S:</syntaxhighlight>
=={{header|Wart}}==
<
=={{header|WDTE}}==
<
=={{header|WebAssembly}}==
{{libheader|WASI}}
<
;;Import fd_write from WASI, declaring that it takes 4 i32 inputs and returns 1 i32 value
Line 3,729 ⟶ 4,824:
)
)
</syntaxhighlight>
=={{header|Wee Basic}}==
<
end</
=={{header|Whenever}}==
<
=={{header|Whiley}}==
<
method main(System.Console console):
console.out.println("Hello world!")</
=={{header|Whitespace}}==
Line 3,754 ⟶ 4,849:
With [[Guile]] and wisp installed, this example can be tested in a REPL started with guile --language=wisp, or directly with the command wisp.
<
scheme write
display "Hello world!"
newline</
=={{header|Wolfram Language}}==
<
=={{header|Wren}}==
<
=={{header|X10}}==
<syntaxhighlight lang="x10">class HelloWorld {
public static def main(args:Rail[String]):void {
if (args.size < 1) {
Console.OUT.println("Hello world!");
return;
}
}
}</syntaxhighlight>
=={{header|X86 Assembly}}==
Line 3,771 ⟶ 4,876:
Prints "Hello world!" to stdout (and there is probably an even simpler version):
<
msg db 'Hello world!', 0AH
len equ $-msg
Line 3,785 ⟶ 4,890:
mov ebx, 0
mov eax, 1
int 80h</
'''AT&T syntax:''' works with gcc (version 4.9.2) and gas (version 2.5):
<
.globl main
Line 3,802 ⟶ 4,907:
.section .data
str: .ascii "Hello world!\12"</
=={{header|X86-64 Assembly}}==
===UASM===
<syntaxhighlight lang="asm">
option casemap:none
if @Platform eq 1
option dllimport:<kernel32>
ExitProcess proto :dword
option dllimport:none
exit equ ExitProcess
endif
printf proto :qword, :vararg
exit proto :dword
.code
main proc
invoke printf, CSTR("Goodbye, World!",10)
invoke exit, 0
ret
main endp
end
</syntaxhighlight>
===AT&T syntax (Gas)===
<syntaxhighlight lang="asm">// No "main" used
// compile with `gcc -nostdlib`
#define SYS_WRITE $1
Line 3,827 ⟶ 4,953:
.data
message: .ascii "Hello, world!\n"</
=={{header|XBasic}}==
{{works with|Windows XBasic}}
<
PROGRAM "hello"
VERSION "0.0003"
Line 3,841 ⟶ 4,967:
END FUNCTION
END PROGRAM
</syntaxhighlight>
=={{header|xEec}}==
<syntaxhighlight lang="xeec">
h#10 h$! h$d h$l h$r h$o h$w h#32
h$o h$l h$l h$e h$H >o o$ p jno
</syntaxhighlight>
=={{header|XL}}==
<
WriteLn "Hello world!"</
=={{header|XLISP}}==
<
(NEWLINE)</
=={{header|XPL0}}==
<
Text(0, "Hello world!
")</
=={{header|XPath}}==
<syntaxhighlight lang="xpath">'Hello world
'</syntaxhighlight>
=={{header|XSLT}}==
With a literal newline:
<syntaxhighlight lang="xml"><xsl:text>Hello world!
</xsl:text></syntaxhighlight>
Or, with an explicit newline:
<syntaxhighlight lang="xml"><xsl:text>Hello world!
</xsl:text></syntaxhighlight>
=={{header|Yabasic}}==
<syntaxhighlight lang="yabasic">
print "Hello world!"
</syntaxhighlight>
=={{header|YAMLScript}}==
All the following examples are valid YAML and valid YAMLScript.
This is a good example of various ways to write function calls in YAMLScript.
Since function calls must fit into their YAML context, which may be mappings or scalars;
it is actually useful to support these variants.
<syntaxhighlight lang="yaml">
!yamlscript/v0
say: "Hello, world!"
=>: (say "Hello, world!")
=>: say("Hello, world!")
say:
=>: "Hello, world!"
say: ("Hello, " + "world!")
say: ."Hello," "world!"
say "Hello,": "world!"
say "Hello," "world!":
</syntaxhighlight>
=={{header|Yorick}}==
<
=={{header|Z80 Assembly}}==
Line 3,873 ⟶ 5,040:
Using the Amstrad CPC firmware:
<
txt_output: equ $bb5a
Line 3,890 ⟶ 5,057:
ret
world: defm "Hello world!\r\n\0"</
=={{header|zkl}}==
<
{{omit from|VBA|VBA can't write or output to console}}
=={{header|Zig}}==
'''Works with:''' 0.10.x, 0.11.x, 0.12.0-dev.1389+42d4d07ef
<syntaxhighlight lang="zig">const std = @import("std");
pub fn main() std.fs.File.WriteError!void {
const stdout = std.io.getStdOut();
try stdout.writeAll("Hello world!\n");
}</syntaxhighlight>
=={{header|Zoea}}==
<
output: "Hello world!"</
=={{header|Zoea Visual}}==
[http://zoea.co.uk/examples/zv-rc/Hello_world.png Hello World]
=={{header|Zoomscript}}==
For typing:
<
For importing:
Line 3,908 ⟶ 5,090:
=={{header|ZX Spectrum Basic}}==
<
|