Movatterモバイル変換


[0]ホーム

URL:


Jump to content
Rosetta Code
Search

Hello world/Text

From Rosetta Code
<Hello world
Task
Hello world/Text
You are encouraged tosolve this task according to the task description, using any language you may know.
Hello world/Text is part ofShort Circuit'sConsole Program Basics selection.
Task

Display the stringHello world! on a text console.

Related tasks



0815

<:48:x<:65:=<:6C:$=$=$$~<:03:+$~<:ffffffffffffffb1:+$<:77:~$~<:fffffffffffff8:x+$~<:03:+$~<:06:x-$x<:0e:x-$=x<:43:x-$

11l

print(‘Hello world!’)

360 Assembly

MVS

Using native SVC (Supervisor Call) to write to system console:

HELLO    CSECT          USING HELLO,15         LA    1,MSGAREA     Point Register 1 to message area         SVC   35            Invoke SVC 35 (Write to Operator)          BR    14            ReturnMSGAREA  EQU   *             Message Area         DC    AL2(19)       Total area length = 19 (Prefix length:4 + Data Length:15)          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:

         WTO   'Hello world!'         BR    14            Return         END

VM/CMS

HELLO    CSECT                        BASR 12,0                    USING *,12                   WRTERM 'HELLO WORLD'         BR 14                        END

This works with both Assembler XF (ASSEMBLE) and High Level Assembler (ASMAHL)

4DOS Batch

echo Hello world!

4ME

Normal 4ME

P:hwout{Hello world!}

Rewriten 4ME

echo{Hello world!}

6502 Assembly

; goodbyeworld.s for C= 8-bit machines, ca65 assembler format.; String printing limited to strings of 256 characters or less.a_cr=$0d; Carriage return.bsout=$ffd2; C64 KERNEL ROM, output a character to current device.; use $fded for Apple 2, $ffe3 (ascii) or $ffee (raw) for BBC..codeldx#0; Starting index 0 in X register.printnext:ldatext,x; Get character from string.beqdone; If we read a 0 we're done.jsrbsout; Output character.inx; Increment index to next character.bneprintnext; Repeat if index doesn't overflow to 0.done:rts; Return from subroutine..rodatatext:.byte"Hello world!",a_cr,0

6800 Assembly

        .cr  6800        .tf  gbye6800.obj,AP1        .lf  gbye6800;=====================================================;;        Hello world! for the Motorola 6800        ;;                 by barrym 2013-03-17                ;;-----------------------------------------------------;; Prints the message "Hello world!" to an ascii    ;;   terminal (console) connected to a 1970s vintage   ;;   SWTPC 6800 system, which is the target device for ;;   this assembly.                                    ;; Many thanks to:                                     ;;   swtpc.com for hosting Michael Holley's documents! ;;   sbprojects.com for a very nice assembler!         ;;   swtpcemu.com for a very capable emulator!         ;; reg x is the string pointer                         ;; reg a holds the ascii char to be output             ;;-----------------------------------------------------;outeee   =   $e1d1      ;ROM: console putchar routine        .or  $0f00;-----------------------------------------------------;main    ldx  #string    ;Point to the string        bra  puts       ;  and print itouts    jsr  outeee     ;Emit a as ascii        inx             ;Advance the string pointerputs    ldaa ,x         ;Load a string character        bne  outs       ;Print it if non-null        swi             ;  else return to the monitor;=====================================================;string  .as  "Hello world!",#13,#10,#0        .en

8080 Assembly

; This is Hello World, written in 8080 assembly to run under CP/M; As you can see, it is similar to the 8086, and CP/M is very; similar to DOS in the way it is called.org100h; CP/M .COM entry point is 100h - like DOSmvic,9; C holds the syscall, 9 = print string - like DOSlxid,msg; DE holds a pointer to the stringjmp5; CP/M calls are accessed through the jump at 05h; Normally you'd CALL it, but since you'd end the program by RETurning,; JMP saves a byte (if you've only got 64k of address space you want to; save bytes). msg:db'Hello world!$'

8086 Assembly

DOSSEG.MODEL TINY.DATATXT DB "Hello world!$".CODESTART:MOV ax, @DATAMOV ds, axMOV ah, 09h; prepare output functionMOV dx, OFFSET TXT; set offsetINT 21h; output string TXTMOV AX, 4C00h ; go back to DOSINT 21hEND START

With A86 or NASM syntax:

  org 100h  mov dx, msg  mov ah, 9  int 21h  mov ax, 4c00h  int 21hmsg:  db "Hello world!$"

8th

"Helloworld!\n".bye

AArch64 Assembly

.equSTDOUT,1.equSVC_WRITE,64.equSVC_EXIT,93.text.global_start_start:stpx29,x30,[sp,-16]!movx0,#STDOUTldrx1,=msgmovx2,13movx8,#SVC_WRITEmovx29,spsvc#0// write(stdout, msg, 13);ldpx29,x30,[sp],16movx0,#0movx8,#SVC_EXITsvc#0// exit(0);msg:.ascii"Hello World!\n".align4

There's no need to push the link register because we are not writing a function that calls another function and it is not recursive. We also do not need to align the stack pointer because we are not even using the stack. Also we can use adr instead of ldr to load an address into a register. We do not need to generate a literal pool. We can also use an expression so the assembler calculates the length of the message. The following example works in Linux on the Raspberry Pi Zero 2 W using the gnu assembler and linker.

.global_start.text_start:movx8,#64//64 is writemovx0,#1//1 is stdoutadrx1,msg//mov address of msg into x1movx2,#(msgend - msg) //msgend minus msg is the length of messagesvc#0//system callmovx8,#93//93 is exitmovx0,xzr//0 is the exit code. xzr is the zero registersvc#0//system callmsg:.ascii"Hello world!\n"msgend:.align4

The last example calculates the length of the string at compile time. It's fast, but not very convenient. The next example calculates the string length at run time. This is nice because we can call this function over and over again on different strings of different lengths. It does add a half dozen instructions and a loop to the code, so it runs a little slower. TheRaspberry Pi Zero 2 W runs at a whopping 1 GHz ;) , so you'll never notice it with the human eye.

.global_start.text_start:adrx0,msg// load x0 with address of messageblwritez// call the function that writes null-terminated string to stdoutmovx8,#93// 93 is syscall exitmovx0,xzr// exit code = 0. Exit normal.svc#0// syscall// If using as a function in C declare it aswritez:// extern long writez(char *str);movx1,x0// address of str needs to be in x1 for syscallsubx0,x0,#1// decrement x0, because the next statement increments it.0:ldrbw2,[x0,#1]!// increment x0, load byte value at x0 in w2cbnzw2,0b// if w2 is not zero jump back to 0: labelsubx2,x0,x1// subtract x1 from x0, load into x2. length of strmovx0,#1// mov into x0 1. stdoutmovx8,#64// mov into x8 64. writesvc#0// syscallret// return from function.// return value (x0) is number of characters written.msg:.asciz"Hello world!\n"// .asciz means null-terminated string. Assembler adds the 0.align4

ABAP

REPORTzgoodbyeworld.WRITE'Hello world!'.

ACL2

(cw"Hello world!~%")

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 asprintc, will not.

(printc'Hello!world!!)

The single quote in front ofHello! world!! 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.

Action!

Proc Main() Print("Hello world!")Return

ActionScript

trace("Hello world!");

Ada

Works with:GCC version 4.1.2
withAda.Text_IO;useAda.Text_IO;procedureMainisbeginPut_Line("Hello world!");endMain;

Adina

вывести/перенос «Hello world!»

or

english()displayln "Hello world!"

Agda

For Agda 2.6.3, based on itsdocumentation.

moduleHelloWorldwhereopenimportAgda.Builtin.IOusing(IO)openimportAgda.Builtin.Unitrenaming(toUnit)openimportAgda.Builtin.Stringusing(String)postulateputStrLn:String->IOUnit{-# FOREIGN GHC import qualified Data.Text as T #-}{-# COMPILE GHC putStrLn = putStrLn . T.unpack #-}main:IOUnitmain=putStrLn"Hello world!"

Agena

print( "Hello world!" )

Aime

o_text("Hello world!\n");

or:

integermain(void){    o_text("Hello world!\n");    return 0;}

Algae

printf("Hello world!\n");

ALGOL 60

'BEGIN'    OUTSTRING(1,'('Hello world!')');    SYSACT(1,14,1)'END'

ALGOL 68

main: (  printf($"Hello world!"l$))

ALGOL W

begin    write( "Hello world!" )end.

ALGOL-M

BEGIN    WRITE( "Hello world!" );END

Alore

Print('Hello world!')

Amazing Hopper

1)

main:   {"Hello world!\n"}printexit(0)
execute with:  hopper helloworld.com

2)

#include <hopper.h>main:   exit("Hello world!\n")
execute with:  hopper helloworld.com -d

3)

main:  {"Hello world!\n"}return
execute with:  hopper helloworld.com -d

AmbientTalk

system.println("Hello world!")

AmigaE

PROC main()  WriteF('Hello world!\n')ENDPROC

AngelScript

void main() { print("Hello world\n"); }

AntLang

Note, that "Hello, World!" prints twice in interactive mode.One time as side-effect and one as the return value of echo.

echo["Hello, World!"]

Anyways

There was a guy called Hello World"Ow!" it said.That's all folks!

APL

'Hello world!'

AppleScript

To show in Script Editor Result pane:

"Hello world!"

To show in Script Editor Event Log pane:

log"Hello world!"

Applesoft BASIC

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.

 PRINT "Hello world!"

Apricot

(puts "Hello world!")

Arc

(prn "Hello world!")

Arendelle

"Hello world!"

Aria

func main() {    println("Hello World!");}

ArkScript

(print "Hello world!")

Argile

use stdprint "Hello world!"

compile with: arc hello_world.arg -o hello_world.c && gcc -o hello_world hello_world.c

ARM Assembly

.global mainmessage:    .asciz "Hello world!\n"    .align 4main:    ldr r0, =message    bl printf    mov r7, #1    swi 0

Alternative versions

 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 1989The 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

ArnoldC

IT'S SHOWTIMETALK TO THE HAND "Hello world!"YOU HAVE BEEN TERMINATED

Arturo

print"Hello world!"
Output:
Hello world!

AsciiDots

.-$'Hello, World!'

Astro

print"Hello world!"

Asymptote

write('Hello world!');

Atari BASIC

10 PRINT "Hello World"

ATS

implement main0 () = print "Hello world!\n"

AutoHotkey

script launched from windows explorer

DllCall("AllocConsole")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]

DllCall("AttachConsole","int",-1)FileAppend,Goodbye`,World!,CONOUT$
SendInputHelloworld!{!}

AutoIt

ConsoleWrite("Hello world!"&@CRLF)

AutoLISP

(print"Hello World!")

Avail

Print: "Hello World!";

AWK

BEGIN{print"Hello world!"}


"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!"}

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}


For a "single record" file.

//  {print"Hello world!"}

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.

//

Axe

Note that the i here is the imaginaryi, not the lowercase letter i.

Disp "Hello world!",i

B

Works with:The Amsterdam Compiler Kit - B version V6.1pre1
main(){    putstr("Hello world!*n");    return(0);}

B4X

Log("Hello world!")

Babel

"Hello world!" <<

BabyCobol

      * Since no quotes are used, two undeclared fields (variables) are printed.      * Their default values are their own names in uppercase.IDENTIFICATIONDIVISION.PROGRAM-ID.USEROUTPUT.PROCEDUREDIVISION.DISPLAYHELLOWORLD.

Bait

fun main() {    println('Hello World!')}

Ballerina

importballerina/io;publicfunctionmain(){io:println("Hello World!");}
Output:
Hello, World!

bash

echo"Hello world!"

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
Works with:ProgressBASIC
10print"Hello world!"


Works with:7Basic
Works with:Applesoft BASIC
Works with:BaCon
Works with:BASIC256
Works with:FreeBASIC
Works with:IS-BASIC
Works with:Just Basic
Works with:M2000 Interpreter
Works with:OxygenBasic
Works with:QBasic
Works with:QB64
Works with:Run BASIC
Works with:Script Basic
Works with:SmallBASIC
Works with:Yabasic
PRINT"Hello world!"

BASIC256

PRINT "Hello world!"

Batch File

Under normal circumstances, when delayed expansion is disabled

echo Hello world!

If delayed expansion is enabled, then the! must be escaped twice (^^)

setlocal enableDelayedExpansionecho Hello world^^!

Using%=ExitCodeAscii%

@echo offsetlocal enableextensionscall:char 72call:char 101call:char 108call:char 108call:char 111call:spacecall:char 119call:char 111call:char 114call:char 108call:char 100call:char 33exit /b 0:space:: https://stackoverflow.com/a/9865960:: https://stackoverflow.com/a/31396993for/f%%Ain('"prompt $H &echo on &for%%B in (1) do rem"')do<nulset/p=".%%A "goto:eof:charcmd /c exit%1<nulset/p=%=ExitCodeAscii%goto:eof

Battlestar

consthello="Hello world!\n"print(hello)

BBC BASIC

PRINT"Hello world!"

bc

"Hello world!"

BCPL

GET "libhdr"LET start() = VALOF{ writef("Hello world!")  RESULTIS 0}

Beef

UsingSystem;namespaceHelloWorld{classProgram{staticvoidMain(){Console.Writeln("Hello World!");}}}

beeswax

Straightforward:

*`Hello, World!

Less obvious way:

>`ld!` r  o   W    `     b` ,olleH`_

Even less obvious, demonstrating the creation and execution order of instruction pointers, and the hexagonal layout of beeswax programs:

r  l l o  ``ol`*`,d!   ``   e H   W

Befunge

52*"!dlroW ,olleH">:#,_@

Binary Lambda Calculus

As explained athttps://www.ioccc.org/2012/tromp/hint.html

 Hello world!

Bird

It's not possible to print exclamation marks inBird which is why it is not used in this example.

use Consoledefine Main    Console.Println "Hello world"end

Blade

echo 'Hello world!'

or

print('Hello world!')

or

import ioio.stdout.write('Hello world!')

Blast

# This will display a goodbye message on the terminal screen.begindisplay "Hello world!"return# This is the end of the script.

BlitzMax

print"Hello world!"

Blue

Linux/x86

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 ;

blz

print("Hello world!")

BML

display "Hello world!"

Boo

print"Hello world!"

bootBASIC

10print"Hello world!"

BQN

Works in:CBQN

•Out"Hello world!"

Brace

#!/usr/bin/env bxuse bMain:say("Hello world!")

Bracmat

put$"Hello world!"

Brainf***

To print text, we need the ascii-value of each character to output.
So, we wanna make a series of round numbers going like:

10close to newline and carriage return30close to ! and SPACE40close to COMMA70close to G80close to W90close to b100is d and close to e and l110close to o120close to y

forming all the letters we need if we just add up a bit

Commented version:

++++++++++First cell 10 (its a counter and we will be "multiplying")[>+10 times 1 is 10>+++10 times 3 is 30>++++etc etc>+++++++>++++++++>+++++++++>++++++++++>+++++++++++>++++++++++++<<<<<<<<<-go back to counter and subtract 1]printing G>>>>+.o twice>>>>+..d<.b<++++++++.y>>>+.e<<+.COMMA<<<<++++.SPACE<++.W>>>+++++++.o>>>.r+++.l<+++++++.d--------.!<<<<<+.CRLF<+++.---.

Uncommented:

++++++++++[>+>+++>++++>+++++++>++++++++>+++++++++>++++++++++>+++++++++++>++++++++++++<<<<<<<<<-]>>>>+.>>>>+..<.<++++++++.>>>+.<<+.<<<<++++.<++.>>>+++++++.>>>.+++.<+++++++.--------.<<<<<+.<+++.---.

It can most likely be optimized, but this is a nice way to show how character printing works in Brainf*** :)

Brat

p "Hello world!"

Brlcad

The mged utility can output text to the terminal:

echo Hello world!

Bruijn

Ignore stdin by not referring to the abstraction:

main ["Hello world!"]

Burlesque

"Hello world!"sh

Although please note thatsh actually does not print anything.

C

C89

The eternal favourite :)

#include<stdio.h>intmain(){printf("\nHello world!");return0;}

Or:

#include<stdio.h>intmain(){returnprintf("\nHello World!");}

C11

Works with:gcc version 4.0.1
#include<stdlib.h>#include<stdio.h>intmain(void){printf("Hello world!\n");returnEXIT_SUCCESS;}

C23

#include<stdlib.h>#include<stdio.h>intmain(void){puts("Hello world!");returnEXIT_SUCCESS;}

C#

Works with:Mono version 1.2
Works with:Visual C# version 2003
namespaceHelloWorld{classProgram{staticvoidMain(string[]args){System.Console.WriteLine("Hello world!");}}}
Works with:Visual C# version 9.0+

C# 9.0 allows statements at the top level of a source file (acompilation_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.

System.Console.WriteLine("Hello world!");

or

usingSystem;Console.WriteLine("Hello world!");

C++

#include<iostream>intmain(){std::cout<<"Hello world!\n";}

Since C++23’s addition of the<print> header and the standard library modulestd we could now write this:

importmodulestd;// here does the same thing as #include <print>intmain(){std::print("Hello world!\n");}

C++/CLI

usingnamespaceSystem;intmain(){Console::WriteLine("Hello world!");}

C1R

Hello_world/Text
Output:
$ echo Hello_world/Text >hw.c1r$ ./c1r hw.c1r$ ./a.outHello world!

C2

module hello_world;import stdio as io;func i32 main(i32 argc, char** argv) {    io.printf("Hello World!\n");    return 0;}

C3

import std::io;fn void main() {    io::printn("Hello, World!");}

Calcscript

(puts Hello world!)

Casio BASIC

Locate 1,1,"Hello World!"

or just

"Hello World!"

Cat

"Hello world!" writeln

Cduce

print "Hello world!";;

CFEngine

#!/usr/bin/env cf-agent# without --no-lock option to cf-agent# this output will only occur once per minute# this is by design.bundleagentmain{reports:"Hello world!";}

Seehttps://docs.cfengine.com/docs/master/examples.html for a more complete example and introduction.

Chapel

writeln("Hello world!");

Chef

Goodbye World Souffle. Ingredients.71 g green beans111 cups oil98 g butter121 ml yogurt101 eggs44 g wheat flour32 zucchinis119 ml water114 g red salmon108 g lard100 g dijon mustard33 potatoes Method.Put potatoes into the mixing bowl.Put dijon mustard into the mixing bowl.Put lard into the mixing bowl.Put red salmon into the mixing bowl.Put oil into the mixing bowl.Put water into the mixing bowl.Put zucchinis into the mixing bowl.Put wheat flour into the mixing bowl.Put eggs into the mixing bowl.Put yogurt into the mixing bowl.Put butter into the mixing bowl.Put dijon mustard into the mixing bowl.Put oil into the mixing bowl.Put oil into the mixing bowl.Put green beans into the mixing bowl.Liquefy contents of the mixing bowl.Pour contents of the mixing bowl into the baking dish. Serves 1.

Chipmunk Basic

10print"Hello world!"

ChucK

<<< "Hello world!">>>;

Cind

execute() {    host.println("Hello world!");}

CJam

"Hello, world!"

Clay

main(){println("Hello world!");}

Clean

Start="Hello world!"

Clio

'hello world!' -> print

Clipper

?"Hello world!"

CLIPS

(printout t "Hello world!" crlf)

CLU

start_up = proc ()    po: stream := stream$primary_output()    stream$putl(po, "Hello world!")end start_up

Clojure

(println"Hello world!")

CMake

message(STATUS"Hello world!")

This outputs

-- Hello world!

COBOL

Using fixed format.

Works with:OpenCOBOL
Works with:Dell Enterprise COBOL
program-id.hello.proceduredivision.display"Hello world!".stoprun.

Using relaxed compilation rules, the hello program can become a single DISPLAY statement.

Works with:GnuCOBOL
display"Hello, world".
prompt$ cobc -x -frelax-syntax -free hello.cobhello.cob: 1: Warning: PROGRAM-ID header missing - assumedhello.cob: 1: Warning: PROCEDURE DIVISION header missing - assumedprompt$ ./helloHello, world

Note how COBOL can handle the DISPLAY reserved word without a space before the quoted string, the quote being a compile time scan delimiter. The full stop period after the single statement is still mandatory, at least for GnuCOBOL and a clean compile to executable.

Cobra

class Hello    def main        print 'Hello world!'

CoffeeScript

Works with:Node.js
console.log"Hello world!"
Works with:Rhino engine
print"Hello world!"

ColdFusion

<cfoutput>Hello world!</cfoutput>

Comal

PRINT"Hello world!"

Comefrom0x10

'Hello world!'
"Hello world!"

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.

10printchr$(147);chr$(14);:REM147=clearscreen,14=switchtolowercasemode20print"Hello world!"30end
Output:
Hello world!

Common Lisp

(formatt"Hello world!~%")

Or

(print"Hello world!")

Alternate solution

I useAllegro CL 10.1

;; Project : Hello world/Text(formatt"~a""Hello world!")

Output:

Hello world!

Component Pascal

MODULEHello;IMPORTOut;PROCEDUREDo*;BEGINOut.String("Hello world!");Out.LnENDDo;ENDHello.

Run commandHello.Do by commander.

Corescript

print Hello world!

Cowgol

include "cowgol.coh";print("Hello world!");print_nl();

Crack

import crack.io cout;cout `Hello world!\n`;

Craft Basic

print"Hello world!"

Creative Basic

OPENCONSOLEPRINT"Hello world!"'This line could be left out.PRINT:PRINT:PRINT"Press any key to end."'Keep the console from closing right away so the text can be read.DO:UNTIL INKEY$<>""CLOSECONSOLEEND

Crystal

puts"Hello world!"

Curto

." Hola, mundo!"

D

Works with:D version 2.0
importstd.stdio;voidmain(){writeln("Hello world!");}

Dafny

method Main() {  print "hello, world!\n";  assert 10 < 2;}

Dao

io.writeln( 'Hello world!' )

Dart

main(){varbye='Hello world!';print("$bye");}

DataWeave

"Hello world!"

DBL

;;       Hello world for DBL version 4 by Dario B.;                                PROC;------------------------------------------------------------------        XCALL FLAGS (0007000000,1)           ;Suppress STOP message        OPEN (1,O,'TT:')        WRITES (1,"Hello world")        DISPLAY (1,"Hello world",10)        DISPLAY (1,$SCR_MOV(-1,12),"again",10)  ;move up, right and print        CLOSE 1END

Dc

[Hello world!]p

...or print a numerically represented string.

5735816763073014741799356604682 P

DCL

$writesys$output"Hello world!"

DDNC

DDNC can only output to a single 7-segment LED display digit, so first we must convert each character into its 7-segment equivalent numerical value.

The three horizontal bars are assigned bits 6, 3, and 0 from top to bottom. The top two vertical bars are assigned bits 5 and 4 while the bottom two vertical bars are assigned bits 2 and 1 from left to right.

Because DDNC can only interpret literals in decimal, each binary number was converted and stored in consecutive memory cells starting at cell 10.

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 100 15 110 15 120 31 130 47 140 59 150 125 160 3 170 0 180 63 190 15 200 12 210 36 220 31 230 17 240 500 30 10 20 15 560 42 2 180 172 330 231 562 561 464

Delphi

programProjectGoodbye;{$APPTYPE CONSOLE}beginWriteLn('Hello world!');end.

DeviousYarn

o:"Hello world!

DIBOL-11

          START     ;Hello World          RECORD  HELLO,         A11, 'Hello World'          PROC          XCALL FLAGS (0007000000,1)          ;Suppress STOP message          OPEN(8,O,'TT:')          WRITES(8,HELLO)          END

Diego

Once the caller has met the computer and its printer...

with_computer(comp1)_printer(lp1)_text(Hello World!);

If the caller is the computer...

with_me()_printer(lp1)_text(Hello World!);

...or can be shortened as...

me()_ptr(lp1)_txt(Hello World!);

If the computer has more than one printer...

me()_printer()_text(Hello World!);

If there are more than one computer which have zero or more printers...

with_computer()_printer()_text(Hello World!);

If there are zero or more printers connected to any thing (device)...

with_printer()_text(Hello World!);

DIV Games Studio

PROGRAM HELLOWORLD;BEGIN    WRITE_TEXT(0,160,100,4,"HELLO WORLD!");    LOOP        FRAME;    ENDEND

DM

/client/New()    ..()    src << "Hello world!"

Draco

proc nonrec main() void:    writeln("Hello world!")corp

Dragon

showln "Hello world!"

Dragonstone

echo "Hello world!"

DreamBerd

print "Hello world!"!

dt

"Hello world!" pl

DuckDB

Works with:DuckDB version V1.1
Works with:DuckDB version V1.0

The program:

#Turnofftabularoutput:.modelist.headersoffselect'Hello world!';

InvocationAssuming the program is in a file named hello.sql:

duckdb < hello.sql

Output:
Hello world!

DWScript

PrintLn('Hello world!');

Dyalect

print("Hello world!")

Dylan

module:hello-worldformat-out("%s\n","Hello world!");

Dylan.NET

Works with:Mono version 2.6.7
Works with:Mono version 2.10.x
Works with:Mono version 3.x.y
Works with:.NET version 3.5
Works with:.NET version 4.0
Works with:.NET version 4.5

One Line version:

Console::WriteLine("Hello world!")

Hello World Program:

//compile using the new dylan.NET v, 11.5.1.2 or later//use mono to run the compiler#refstdasm mscorlib.dllimport Systemassembly helloworld exever 1.2.0.0class public Program   method public static void main()      Console::WriteLine("Hello world!")   end methodend class

Déjà Vu

!print "Hello world!"

E

println("Hello world!")stdout.println("Hello world!")

EasyLang

print "Hello world!"

eC

classGoodByeApp:Application{voidMain(){PrintLn("Hello world!");}}

EchoLisp

(display"Hello world!""color:blue")

ECL

OUTPUT('Hello world!');

Ecstasy

moduleHelloWorld{voidrun(){@InjectConsoleconsole;console.print("Hello, World!");}}

Ed

aHello World!.pQ

EDSAC order code

The EDSAC did not support lower-case letters. The method used here is to include a separateO 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 atHello world/Line printer#EDSAC order code.

[ Print HELLO WORLD ][ A program for the EDSAC ][ Works with Initial Orders 2 ]T64K  [ Set load point: address 64 ]GK    [ Set base address ]O13@  [ Each O order outputs one ]O14@  [ character. The numerical ]O15@  [ parameter gives the offset ]O16@  [ (from the base address) where ]O17@  [ the character to print is ]O18@  [ stored ]O19@O20@O21@  O22@O23@O24@ZF    [ Stop ]*F    [ Shift to print letters ]HF    [ Character literals ]EFLFLFOF!F    [ Space character ]WFOFRFLFDFEZPF  [ Start program beginning at        the load point ]
Output:
HELLO WORLD

Efene

short version (without a function)

io.format("Hello world!~n")

complete version (put this in a file and compile it)

@public run = fn () {    io.format("Hello world!~n")}

Egel

def main = "Hello World!"

Egison

(define $main  (lambda [$argv]    (write-string "Hello world!\n")))

EGL

Works with:EDT
Works with:RBD
program HelloWorld    function main()        SysLib.writeStdout("Hello world!");    endend

Eiffel

This page uses content fromWikipedia. The original article was atEiffel (programming language). The list of authors can be seen in thepage history.As with Rosetta Code, the text of Wikipediais available under theGNU FDL. (See links for details on variance)
classHELLO_WORLDcreatemakefeaturemakedoprint("Hello world!%N")endend

Ela

open monad iodo putStrLn "Hello world!" ::: IO

Elan

putline ("Hello, world!");

elastiC

From theelastiC Manual.

package hello;    // Import the `basic' package    import basic;    // Define a simple function    function hello()    {        // Print hello world        basic.print( "Hello world!\n" );    }    /*     *  Here we start to execute package code     */    // Invoke the `hello' function    hello();

Elena

ELENA 6.x:

public Program(){    console.writeLine("Hello world!")}

Elisa

 "Hello world!"?

Elixir

IO.puts"Hello world!"

Elm

main=text"Goodbye World!"

Emacs Lisp

(message"Hello world!")

Alternatively,princ can be used:

(princ"Hello world!\n")

EMal

writeLine("Hello world!")

Emojicode

🏁 🍇  😀 🔤Hello world!🔤🍉

Enguage

This shows "hello world", and shows how Enguage can generate this program on-the-fly.

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.

Output:

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 +++

Erlang

io:format("Hello world!~n").

ERRE

! Hello World in ERRE languagePROGRAM HELLOBEGIN  PRINT("Hello world!")END PROGRAM

Euler Math Toolbox

"Hello world!"

Extended BrainF***

[.>]@Hello world!

Extended Color BASIC

PRINT "HELLO WORLD!"

Ezhil

பதிப்பி"வணக்கம் உலகம்!"
பதிப்பி "Hello world!"
பதிப்பி"******* வணக்கம்! மீண்டும் சந்திப்போம் *******"
exit()

F#

printfn "%s" "Hello world!"

or using .Net classes directly

System.Console.WriteLine("Hello world!")

Factor

"Hello world!" print

Falcon

With the printl() function:

printl("Hello world!")

Or via "fast print":

> "Hello world!"

FALSE

"Hello world!"

Fantom

class HelloText{  public static Void main ()  {    echo ("Hello world!")  }}

Fe

(print "Hello World")

Fennel

(print "Hello World")

ferite

word.}}

uses "console";Console.println( "Goodby, World!" );

Fermat

!!'Hello, World!';

Fexl

say "Hello world!"

Fhidwfe

puts$ "Hello, world!\n"

Fish

Standard Hello, world example, modified for this task:

!v"Hello world!"r! >l?!;o

Explanation of the code:
!v" jumps over thev character with the! sign, then starts the string mode with" .
Then the charactersHello world! are added, and string mode is closed with".
The stack is reversed for printing (r), and a jump (!) is executed to jump over the! at the beginning of the line and execute thev. (Fish is torical)
After going down byv, it goes rightwards again by> and this line is being executed.
This line pushes the stack size (l), and stops (;) if the top item on the stack is equal to 0 (?). Else it executes the! directly after it and jumps to theo, which outputs the top item inASCII. Then the line is executed again. It effectively prints the stack until it's empty, then it terminates.

FOCAL

TYPE "Hello, world" !

Forth

." Hello world!"

Or as a whole program:

: goodbye ( -- )   ." Hello world!" CR ;

Fortran

Works with:F77

Simplest case - display using default formatting:

print *,"Hello world!"

Use explicit output format:

100   format (5X,A,"!")      print 100,"Hello world!"

Output to channels other than stdout goes like this:

write (89,100) "Hello world!"

uses the format given at label 100 to output to unit 89. If output unit with this number exists yet (no "OPEN" 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 "fort.89".Template:7*7

Fortress

export Executable                                                                                                                                                                                                                                                               run() = println("Hello world!")

FreeBASIC

? "Hello world!"sleep


Free Pascal

PROGRAM HelloWorld ;{$APPTYPE CONSOLE}(*)         https://www.freepascal.org/advantage.var(*)USES    crt;BEGIN  WriteLn ( 'Hello world!' ) ;END.

Frege

Works with:Frege version 3.20.113
module HelloWorld wheremain _ = println "Hello world!"

friendly interactive shell

Unlike otherUNIX shell languages, fish doesn't support history substitution, so! is safe to use without quoting.

echo Hello world!

Frink

println["Hello world!"]

FTCBASIC

print "Hello, world!"pauseend

FuncSug

displayNewMessage('Hello, world!')

in browser

print('Hello, world!')

in console

FunL

println( 'Hello world!' )


Furor

."Hello, World!\n"

FutureBasic

window 1print @"Hello world!"HandleEvents

FUZE BASIC

PRINT "Hello world!"

Gambas

Click this link to run this code

Public Sub Main()PRINT "Hello world!" End

GAP

# Several ways to do it"Hello world!";Print("Hello world!\n"); # No EOL appendedDisplay("Hello world!");f := OutputTextUser();WriteLine(f, "Hello world!\n");CloseStream(f);

GB BASIC

10 print "Hello world!"

gecho

'Hello, <> 'World! print

Gema

Gema ia a preprocessor that reads an input file and writes an output file.This code will write "Hello world!' no matter what input is given.

*= ! ignore off content of input\B=Hello world!\! ! Start output with this text.

Genie

init    print "Hello world!"

Gentee

func hello <main>{   print("Hello world!")}

GFA Basic

PRINT "Hello World"

GLBasic

STDOUT "Hello world!"

Gleam

import gleam/iopub fn main() {    io.println("Hello world!")}

Glee

"Hello world!"

or

'Hello world!'

or to display with double quotes

 '"Goodbye,World!"'

or to display with single quotes

 "'Goodbye,World!'"

Global Script

This uses thegsio I/O operations, which are designed to be simple to implement on top of Haskell and simple to use.

λ _. print qq{Hello world!\n}

GlovePIE

debug="Hello world!"

GML

show_message("Hello world!"); // displays a pop-up messageshow_debug_message("Hello world!"); // sends text to the debug log or IDE

Go

package mainimport "fmt"func main() { fmt.Println("Hello world!") }

Golfscript

"Hello world!"

Gosu

print("Hello world!")

Grain

print("Hello world!")

Groovy

println "Hello world!"

GW-BASIC

10 PRINT "Hello world!"

Hack

<?hh echo 'Hello world!'; ?>

Halon

If the code in run in the REPL the output will be to stdout otherwise syslog LOG_DEBUG will be used.

echo "Hello world!";

Harbour

? "Hello world!"

Hare

use fmt;export fn main() void = {fmt::println("Hello, world!")!;};

Haskell

main = putStrLn "Hello world!"

Haxe

trace("Hello world!");

hexiscript

println "Hello world!"

HicEst

WRITE() 'Hello world!'

HLA

program goodbyeWorld;#include("stdlib.hhf")begin goodbyeWorld;  stdout.put( "Hello world!" nl );end goodbyeWorld;

Hobbes

putStrLn("Hello world!")

HolyC

"Hello world!\n";

Hoon

~&  "Hello world!"  ~

Hopper

program Hello{    uses "/Source/Library/Boards/PiPico"        Hopper()    {        WriteLn("Hello world!");        loop        {            LED = !LED;            Delay(500);        }    }}
Output:

In IDE, build hello.hs into hello.hexe, (press F7) and start debug (F5) or hm console monitor.

!> helloHello world!

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

HPPPL

PRINT("Hello world!");

HQ9+

This example isincorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements (and is probably incapable of solving the task).

H
  • Technically, HQ9+ can't print "Hello world!" text because of its specification.

- H : Print 'Hello World!'
- Q : Quine
- 9 : Print '99 Bottles of Beer'
- + : Increase Pointer (useless!)

Huginn

#! /bin/shexec huginn --no-argv -E "${0}" "${@}"#! huginnmain() {print( "Hello World!\n" );return ( 0 );}

HTML5

<!DOCTYPE html><html><body><h1>Hello world!</h1></body></html>

Hy

(print "Hello world!")

i

software {    print("Hello world!")}

IBM 1620 SPS

The exclamation mark character is not supported on the IBM 1620, so this program will just print "HELLO WORLD".

     START WATYHELLO           H     HELLO DAC 12,HELLO WORLD@           DENDSTART

IBM Z HL/ASM

Using Modern IBM Z High Level assembler to write 'Hello World' to the Unix System Services 'stdout' file descriptor

        PRINT ON,GEN,DATAHELLO   CSECTHELLO   RMODE ANYHELLO   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=LBPXWRTL EQU *-BPXWRTSHW      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  FRECSIZE EQU RECEND-*REC     DS CL80RECEND  EQU *RECA    DS  ABPXWRTD DS  CL(BPXWRTL)ALET    DS  FRECL    DS  FRV      DS  FRC      DS  FRN      DS  FDYNL EQU *-DYNAREA*** End of working storage*** Equates*R0      EQU 0R1      EQU 1R2      EQU 2R3      EQU 3R4      EQU 4R5      EQU 5R6      EQU 6R7      EQU 7R8      EQU 8R9      EQU 9R10     EQU 10R11     EQU 11R12     EQU 12R13     EQU 13R14     EQU 14R15     EQU 15        END

Icon andUnicon

procedure main()  write( "Hello world!" )end

IDL

print,'Hello world!'

Idris

module Mainmain : IO ()main = putStrLn "Hello world!"

Inform 6

[Main;  print "Hello world!^";];

Inko

import std::stdio::stdoutstdout.print('Hello, world!')

Insitux

(print "Hello, world!")

Intercal

DO ,1 <- #13PLEASE DO ,1 SUB #1 <- #238DO ,1 SUB #2 <- #108DO ,1 SUB #3 <- #112DO ,1 SUB #4 <- #0DO ,1 SUB #5 <- #64DO ,1 SUB #6 <- #194PLEASE DO ,1 SUB #7 <- #48DO ,1 SUB #8 <- #26DO ,1 SUB #9 <- #244PLEASE DO ,1 SUB #10 <- #168DO ,1 SUB #11 <- #24DO ,1 SUB #12 <- #16DO ,1 SUB #13 <- #162PLEASE READ OUT ,1PLEASE GIVE UP


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.

   10 PRINT "Hello world!"   20 END

Io

"Hello world!" println

Ioke

"Hello world!" println

IS-BASIC

PRINT "Hello world!"

Isabelle

theory Scratch  imports Mainbegin  value ‹''Hello world!''›end

IWBASIC

OPENCONSOLEPRINT"Hello world!"'This line could be left out.PRINT:PRINT:PRINT"Press any key to end."'Keep the console from closing right away so the text can be read.DO:UNTIL INKEY$<>""CLOSECONSOLEEND

J

   'Hello world!'Hello world!

Here are some redundant alternatives:

   [data=. 'Hello world!'Hello world!   dataHello world!   smoutput dataHello world!   NB. unassigned names are verbs of infinite rank awaiting definition.   NB. j pretty prints the train.   Hello World!Hello World !   NB. j is glorious, and you should know this!   i. 2 3   NB. an array of integers0 1 23 4 5   verb_with_infinite_rank =: 'Hello world!'"_   verb_with_infinite_rank i. 2 3Hello world!      verb_with_atomic_rank =: 'Hello world!'"0   verb_with_atomic_rank i. 2 3Hello world!Hello world!Hello world!Hello world!Hello world!Hello world!

Jack

class Main {  function void main () {    do Output.printString("Hello world!");    do Output.println();    return;  }}

Jacquard Loom

This weaves the string "Hello world!"

+---------------+|               ||    *    *     ||*   *    *  *  ||*           * *||*           * *||*  *         * ||   *     *   * ||         *     |+---------------++---------------+|               ||*   *    *     ||*   *    *     ||            * *||            * *||*  *         * ||*  *     *   * ||         *     |+---------------++---------------+|               ||*   **   * *   ||*******  *** * || **** *   * ***|| **** *  ******|| ******   ** * ||   * *   *   * ||         *     |+---------------++---------------+|               ||*******  *** * ||*******  *** * ||           ** *||*        *  * *||*******   ** * ||*******  *** * ||         *     |+---------------++---------------+|               ||*******  *** * ||*******  *** * ||      *  *  * *||      *  *  * *||*******  **  * ||*******  **  * ||         *     |+---------------++---------------+|               ||***** *  *** * ||*******  *** * ||     * * *  *  ||     * *    *  ||******   **  * ||******   **  * ||         *     |+---------------++---------------+|               ||    *    * *   ||***** *  ***** ||***** **  * ***||***** **  * ***||*******   * ** ||   * *   *   * ||         *     |+---------------++---------------+|               ||               ||     * *       ||     * *       ||     *         ||     *         ||               ||               |+---------------+

Jactl

Jactl uses print and println (adds newline) for output:

print 'Hello'println 'World'

Strings with double quotes allow interpolation of variables and expressions:

def x = 'Hello'println "$x World"println "There are ${60 * 60 * 24} seconds in a day"

Jai

#import "Basic";main :: () {    print("Hello, World!\n");}

Jakt

fn main() {    println("Hello world!")}

Janet

(print "Hello world!")

Java

public class HelloWorld{ public static void main(String[] args) {  System.out.println("Hello world!"); }}

JavaScript

document.write("Hello world!");
Works with:NJS version 0.2.5
Works with:Rhino
Works with:SpiderMonkey
print('Hello world!');
Works with:JScript
WScript.Echo("Hello world!");
Works with:Node.js
console.log("Hello world!")

JCL

/*MESSAGE Hello world!

Jinja

from jinja2 import Templateprint(Template("Hello World!").render())

A bit more convoluted, really using a template:

from jinja2 import Templateprint(Template("Hello {{ something }}!").render(something="World"))

Joy

"Hello world!\n" putchars.

jq

"Hello world!"

JSE

Print "Hello world!"

Jsish

puts("Hello world!")

Julia

println("Hello world!")

K

"Hello world!"

Some of the other ways this task can be attached are:

`0: "Hello world!\n"
s: "Hello world!"s
\echo "Hello world!"

Kabap

return = "Hello world!";

Kaya

program hello; Void main() {    // My first program!    putStrLn("Hello world!");}

Kdf9 Usercode

This example isincorrect. Please fix the code and remove this message.

Details: output isn't consistent with the task's requirements: wording, punctuation.

 V2; W0;RESTART; J999; J999;PROGRAM;                   (main program);   V0 = Q0/AV1/AV2;   V1 = B0750064554545700; ("Hello" in Flexowriter code);   V2 = B0767065762544477; ("World" in Flexowriter code);   V0; =Q9; POAQ9;         (write "Hello World" to Flexowriter);999;  OUT;   FINISH;

Keg

Hello world\!

Kite

simply a single line

"#!/usr/local/bin/kite"Hello world!"|print;

Kitten

"Hello world!" say

KL1

:- module main.main :-      unix:unix([stdio(normal(S))]),      S = [fwrite("Hello world\n")].

Koka

fun main() {  println("Hello world!")}

Alternatively:

- indentation instead of braces

- uniform function call syntax

- omitted parentheses for function calls with no parameters

fun main()  "Hello world!".println

Komodo

println("Hello world!")

KonsolScript

Displays it in a text file or console/terminal.

function main() {  Konsol:Log("Hello world!")}

Kotlin

fun main() {    println("Hello world!")}

KQL

print 'Hello world!'

KSI

`plain'Hello world!' #echo #

Labyrinth

72.101.108:..111.32.119.111.114.108.100.33.\@

Lambdatalk

Hello world!{h1 Hello world!}_h1 Hello world!\n

Lang

fn.println(Hello world!)

Lang5

"Hello world!\n" .

langur

writeln "Hello"

Lasso

A plain string is output automatically.

'Hello world!'

LaTeX

\documentclass{minimal}\begin{document}Hello World!\end{document}

Latitude

putln "Hello world!".

LC3 Assembly

.orig x3000LEA R0, hello    ; R0 = &helloTRAP x22         ; PUTS (print char array at addr in R0)HALThello .stringz "Hello World!".end

Or (without PUTS)

.orig x3000LEA R1, hello        ; R1 = &helloTOP LDR R0, R1, #0   ; R0 = R1[0]BRz END              ; if R0 is string terminator (x0000) go to ENDTRAP x21             ; else OUT (write char in R0)ADD R1, R1, #1       ;      increment R1BR TOP               ;      go to TOPEND HALThello .stringz "Hello World!".end

LDPL

procedure:display "Hello World!" crlf

Lean

#eval "Hello world!"

Slightly longer version:

def main : IO Unit :=  IO.println ("Hello world!")#eval main

LFE

(: io format '"Hello world!~n")

Liberty BASIC

print "Hello world!"

LIL

## Hello world in lil#print "Hello, world!"

Lily

There are two ways to do this. First, with the builtin print:

print("Hello world!")

Second, by using stdout directly:

stdout.print("Hello world!\n")

LilyPond

\version "2.18.2"global = {  \time 4/4  \key c \major  \tempo 4=100}\relative c''{ g e e( g2)}\addlyrics {  Hel -- lo,   World!}

Limbo

implement Command;  include "sys.m";     sys: Sys;  include "draw.m";  include "sh.m";  init(nil: ref Draw->Context, nil: list of string) {     sys = load Sys Sys->PATH;     sys->print("Hello world!\n"); }

Lingo

put "Hello world!"

or:

trace("Hello world!")

Lisaac

Works with:Lisaac version 0.13.1

You can print to standard output in Lisaac by calling STRING.print or INTEGER.print:

Section Header          // The Header section is required.  + 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:

Section Header          // The Header section is required.  + name := GOODBYE2;   // Define the name of this object.Section Public  - main <- (IO.put_string "Hello world!\n";);

Little

Output to terminal:

puts("Hello world!");

Without the newline terminator:

puts(nonewline: "Hello world!");

Output to arbitrary open, writable file, for example the standard error channel:

puts(stderr, "Hello world!");

LiveCode

Examples using the full LiveCode IDE.

Text input and output done in the Message palette/window:

put "Hello World!"

Present a dialog box to the user

Answer "Hello World!"

Example using command-line livecode-server in shell script

#! /usr/local/bin/livecode-serverset the outputLineEndings to "lf"put "Hello world!" & return

Livecode also supports stdout as a device to write to

write "Hello world!" & return to stdout

LLVM

; const char str[14] = "Hello World!\00"@str = private unnamed_addr constant  [14 x i8] c"Hello, world!\00"; declare extern `puts` methoddeclare i32 @puts(i8*) nounwinddefine i32 @main(){  call i32 @puts( i8* getelementptr ([14 x i8], [14 x i8]* @str, i32 0,i32 0))  ret i32 0}

Lobster

print "Hello world!"

Logo

Print includes a line feed:

print [Hello world!]

Type does not:

type [Hello world!]

Logtalk

:- object(hello_world).    % the initialization/1 directive argument is automatically executed    % when the object is loaded into memory:    :- initialization(write('Hello world!\n')).:- end_object.

LOLCODE

HAICAN HAS STDIO?VISIBLE "Hello world!"KTHXBYE

LotusScript

:- object(hello_world).    'This will send the output to the status bar at the bottom of the Notes client screen    print "Hello world!":- end_object.

LSE

AFFICHER [U, /] 'Hello world!'

LSE64

"Hello world!" ,t nl

Lua

Function calls with either a string literal or a table constructor passed as their only argument do not require parentheses.

print "Hello world!"

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

Luna

def main:    hello = "Hello, World!"    print hello

M2000 Interpreter

module HelloWorld {    print "Hello World!"}HelloWorld

M4

For the particular nature of m4, this is simply:

`Hello world!'

MACRO-10

        TITLE HELLOCOMMENT !  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

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


Maclisp

(format t "Hello world!~%")

Or

(print "Hello world!")

MAD

           VECTOR VALUES HELLO = $11HHELLO WORLD*$           PRINT FORMAT HELLO           END OF PROGRAM

make

Makefile contents:

all:$(info Hello world!)

Running make produces:

Hello world!
make: Nothing to be done for `all'.

Malbolge

Long version:

('&%:9]!~}|z2Vxwv-,POqponl$Hjig%eB@@>}=<M:9wv6WsU2T|nm-,jcL(I&%$#"`CB]V?Tx<uVtT`Rpo3NlF.Jh++FdbCBA@?]!~|4XzyTT43Qsqq(Lnmkj"Fhg${z@>

Short version:

(=<`#9]~6ZY32Vx/4Rs+0No-&Jk)"Fh}|Bcy?`=*z]Kw%oG4UUS0/@-ejc(:'8dc
Output:
HELLO WORLD!

MANOOL

In “applicative” notation:

{{extern "manool.org.18/std/0.3/all"} in WriteLine[Out; "Hello world!"]}

OOPish notation (equivalent to the above, up to Abstract Syntax Tree):

{{extern "manool.org.18/std/0.3/all"} in Out.WriteLine["Hello world!"]}

LISPish notation (ditto):

{{extern "manool.org.18/std/0.3/all"} in {WriteLine Out "Hello world!"}}

Using a colon punctuator (ditto):

{{extern "manool.org.18/std/0.3/all"} in: WriteLine Out "Hello world!"}

Note that all semicolons, wherever allowed, are optional. The above example with all possible semicolons:

{{extern; "manool.org.18/std/0.3/all"} in: WriteLine; Out; "Hello world!"}

Maple

> printf( "Hello world!\n" ): # print without quotesHello world!

MariaDB

SELECT 'Hello world!' AS greeting;VALUES ('Hello world!');

Mastermind

output "Hello world!\n";

Mathcad

Simply type the following directly onto a Mathcad worksheet (A worksheet is Mathcad's combined source code file & console).

"Hello, World!"

Applies to Mathcad Prime, Mathcad Prime Express and Mathcad 15 (and earlier)

Mathematica /Wolfram Language

Print["Hello world!"]

MATLAB

>> disp('Hello world!')


Maude

fmod BYE-WORLD isprotecting STRING .op sayBye : -> String .eq sayBye = "Hello world!" .endfmred sayBye .

Maxima

print("Hello world!");

MAXScript

print "Hello world!"

or:

format "%" "Hello world!"

MDL

<PRINC "Hello world!"><CRLF>

MEL

proc helloWorld () {   print "Hello, world!\n";}

MelonBasic

Say:Hello world!helloWorld;

Mercury

:- module hello.:- interface.:- import_module io.:- pred main(io::di, io::uo) is det.:- implementation.main(!IO) :-    io.write_string("Hello world!\n", !IO).

Metafont

message "Hello world!"; end

Microsoft Small Basic

TextWindow.WriteLine("Hello world!")

min

"Hello world!" puts

Minimal BASIC

10 PRINT "Hello world!"20 END

MiniScript

print "Hello world!"

MiniZinc

output ["Hello World"];
Output:
Hello World----------

MIPS Assembly

Works with:MARS

and

Works with:SPIM
   .data #section for declaring variableshello:  .asciiz "Hello world!" #asciiz automatically adds the null terminator. If it's .ascii it doesn't have it.   .text # beginning of codemain: # a label, which can be used with jump and branching instructions.   la $a0, hello # load the address of hello into $a0   li $v0, 4 # set the syscall to print the string at the address $a0   syscall # make the system call   li $v0, 10 # set the syscall to exit   syscall # make the system call

Miranda

main :: [sys_message]main = [Stdout "Hello, world!\n"]

mIRC Scripting Language

echo -ag Hello world!

ML/I

Hello world!

Modula-2

MODULE Hello;IMPORT InOut;BEGIN  InOut.WriteString('Hello world!');  InOut.WriteLnEND Hello.

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.

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.

Modula-3

MODULE Goodbye EXPORTS Main;IMPORT IO;BEGIN  IO.Put("Hello world!\n");END Goodbye.

MontiLang

|Hello, World!| PRINT .

MoonBit

///|fn main {  println("Hello world!")}

Morfa

import morfa.io.print;func main(): void{    println("Hello world!");}

Mosaic

proc main =    println "Hello, world"end

Or just:

println "Hello, world"

MSX Basic

10 PRINT "Hello world!"

MUF

: main[ -- ]me @ "Hello world!" notifyexit;

MUMPS

Write "Hello world!",!

MyDef

Run with:

mydef_run hello.def

Perl:

$print Hello world

C:

module: c$print Hello world

python:

module: python$print Hello world

JavaScript

module: js$print "Hello world"

go:

module: go$print Hello world

MyrtleScript

script HelloWorld {    func main returns: int {        print("Hello World!")    }}

MySQL

SELECT 'Hello world!';

Mythryl

print "Hello world!";

N/t/roff

To get text output, compile the source file using NROFF and set output to the text terminal. If you compile using TROFF, you will get graphical output suitable for typesetting on a graphical typesetter/printer instead.

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.

Hello world!

Nanoquery

println "Hello world!"

Neat

void main() writeln "Hello world!";

Neko

$print("Hello world!");

Nemerle

class Hello{  static Main () : void  {    System.Console.WriteLine ("Hello world!");  }}

Easier method:

System.Console.WriteLine("Hello world!");

NetRexx

say  'Hello world!'

Never

func main() -> int {    prints("Hello world!\n");    0}
Output:
prompt$ never -f hello.nevHello world!

newLISP

Works with:newLisp version 6.1 and after
(println "Hello world!")

Nickle

printf("Hello world!\n")

Nim

echo("Hello world!")

usingstdout

stdout.writeLine("Hello World!")

Nit

print "Hello world!"

Nix

"Hello world!"

NLP++

@CODE"output.txt" << "Hello world!";@@CODE

Nom

begin { add 'hello world'; print; quit; }

NS-HUBASIC

As lowercase characters are not offered in NS-HUBASIC, perhaps some flexibility in the task specification could be offered.

Using?:

10 ? "HELLO WORLD!"

UsingPRINT:

10 PRINT "HELLO WORLD!"

Nu

print "Hello world!"

Nutt

module hello_worldimports native.io.output.saysay("Hello, world!")end

Nyquist

Interpreter:Nyquist (3.15)

LISP syntax

(format t "Hello world!")

Or

(print "Hello world!")

SAL syntax

print "Hello World!"

Or

exec format(t, "Hello World!")

Oberon-2

MODULE Goodbye;IMPORT Out;  PROCEDURE World*;  BEGIN    Out.String("Hello world!");Out.Ln  END World;BEGIN  World;END Goodbye.

Objeck

class Hello {  function : Main(args : String[]) ~ Nil {    "Hello world!"->PrintLine();  }}

ObjectIcon

import ioprocedure main ()  io.write ("Hello world!")end
Output:
$ oiscript hello-OI.icnHello world!

Objective-C

Works with:clang-602.0.53

The de facto Objective-C "Hello, World!" program is most commonly illustrated as the following, using the NSLog() function:

#import <Foundation/Foundation.h>int main() {    @autoreleasepool {        NSLog(@"Hello, World!");    }}

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.

The following code prints the message to standard output without a timestamp using exclusively Objective-C messages:

#import <Foundation/Foundation.h>int main() {    @autoreleasepool {        NSFileHandle *standardOutput = [NSFileHandle fileHandleWithStandardOutput];        NSString *message = @"Hello, World!\n";        [standardOutput writeData:[message dataUsingEncoding:NSUTF8StringEncoding]];    }}

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>int main() {    @autoreleasepool {        NSString *message = @"Hello, World!\n";        printf("%s", message.UTF8String);    }}

OCaml

print_endline "Hello world!"

Occam

Works with:kroc
#USE "course.lib"PROC main (CHAN BYTE screen!)  out.string("Hello world!*c*n", 0, screen):

Octave

disp("Hello world!");

Or, using C-style function printf:

printf("Hello world!");

Odin

package mainimport "core:fmt"main :: proc() {  fmt.println("Hellope!");}

Oforth

"Hello world!" .

Ol

(print "Hello world!")

Onyx

`Hello world!\n' print flush

Onyx (wasm)

use core {printf}main :: () {    printf("Hello world!");}
Output:
Hello world!

OOC

To print a String, either call its println() method:

main: func {  "Hello world!" println()}

Or call the free println() function with the String as the argument.

main: func {  println("Hello world!")}

ooRexx

Refer also to theRexx andNetRexx solutions. Simple output is common to most Rexx dialects.

/* Rexx */say 'Hello world!'

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

Output:Hello world!"Hello world!"

Openscad

echo("Hello world!");  // writes to the consoletext("Hello world!");  // creates 2D text in the object spacelinear_extrude(height=10) text("Hello world!"); // creates 3D text in the object space


OPL

Tested with Psion Series 3a & Series 5.   source

PROC main:    PRINT "Hello, world!"    GETENDP

Owl Lisp

(print "Hello world!")
Output:
$ ol hello-Owl.scmHello world!


Oxygene

Fromwp:Oxygene (programming language)

namespace HelloWorld; interface type  HelloClass = class  public    class method Main;   end; implementation class method HelloClass.Main;begin  writeLn('Hello world!');end; end.
Output:
Hello world!

OxygenBasic

print "Hello world!"

Oz

{Show "Hello world!"}

PARI/GP

print("Hello world!")

Pascal

Works with:Free Pascal
program byeworld;begin writeln('Hello world!');end.

PascalABC.NET

// Hello world/Text. Nigel Galloway: January 25th., 2023begin  System.Console.WriteLine('Hello World!');end.

PascalABC.NET supports classical pascal syntax:

program HelloWorld;begin  writeln('Hello World!');end.

New syntax for an "one line" program

##println('Hello World!');


Output:
Hello World!

PASM

print "Hello world!\n"end

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/ below: location specifier - told assembler what address to assemble to100/lup,lac i ptr/ load ac from address stored in pointercli/ clear io registerlu2,rcl 6s/ rotate combined ac + io reg 6 bits to the left/ left 6 bits in ac move into right 6 bits of io regtyo/ type out character in 6 right-most bits of io regsza/ skip next instr if accumulator is zerojmp lu2/ otherwise do next character in current wordidx ptr/ increment pointer to next word in messagesas end/ skip next instr if pointer passes the end of messagejmp lup/ otherwise do next word in messagehlt/ halt machineptr,msg/ pointer to current word in messagemsg,text "hello, world"/ 3 6-bit fiodec chars packed into each 18-bit wordend,.         / sentinel for end of messagestart 100/ tells assembler where program starts

PDP-11 Assembly

This is Dennis Ritchie's Unix Assembler ("as"). Other PDP-11 assemblers include PAL-11R, PAL-11S and MACRO-11.

Works with:UNIX version 1

to

Works with:UNIX version 7
.globl  start.textstart:        mov$1,r0               / r0=stream, STDOUT=$1sys4; outtext; outlen  / sys 4 is writesys1                   / sys 1 is exitrtspc                  / in case exit returns.dataouttext: <Hello world!\n>outlen = . - outtext

Pebble

;Hello world example program;for x86 DOS;compile with Pebble;compiled com program is 51 bytesprogram examples\hellobeginecho "Hello, world!"pausekillend

PepsiScript

The letters are only outputted in uppercase in the running program. However, lowercase characters can be used in the code instead.

For typing:

#include default-libraries#author Childishbeatclass Hello world/Text:function Hello world/Text:print "Hello world!"end

For importing:

•dl◘Childishbeat◙♦Hello world/Text♪♣Hello_world!♠

Peri

."Hello, World!\n"

Perl

Works with:Perl version 5.8.8
print "Hello world!\n";
Works with:Perl version 5.10.x

Backported from Raku:

use feature 'say';say 'Hello world!';

or:

use 5.010;say 'Hello world!';

Peylang

chaap 'Hello world!';
Output:
$ peyman hello.peyHello world!

Pharo

"Comments are in double quotes""Sending message printString to 'Hello World' string"'Hello World' printString

Phix

Library:Phix/basics
puts(1,"Hello world!")

PHL

module helloworld;extern printf;@Integer main [    printf("Hello world!");    return 0;]

PHP

<?phpecho "Hello world!\n";?>

Alternatively, any text outside of the<?php ?> tags will be automatically echoed:

Hello world!

Picat

println("Hello, world!")

PicoLisp

(prinl "Hello world!")

Pico-8

print("hello, world!")

In Pico-8, the? is an alias for theprint function. Additionally, functions which only require 1 argument that is a table or a string can be called without brackets, so the code block below is not only valid, but also the most token-efficient option.

? 'hello, world!'

Pict

Using the syntax sugared version:

(prNL "Hello World!");

Using the channel syntax:

new done: ^[]run ( prNL!["Hello World!" (rchan done)]    | done?_ = () )

Pikachu

pikachu pika pikachu pika pika pi pi pika pikachu pika pikachu pi pikachu pi pikachu pi pika pi pikachu pikachu pi pi pika pika pikachu pika pikachu pikachu pi pika pi pika pika pi pikachu pikachu pi pikachu pi pika pikachu pi pikachu pika pikachu pi pikachu pikachu pi pikachu pika pika pikachu pi pikachu pi pi pikachu pikachu pika pikachu pi pika pi pi pika pika pikachu pikachu pi pi pikachu pi pikachupikachu pikachu pi pikachupikachu 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 pikachupikachu pikachu pi pikachupikachu pika pi pika pika pikachu pika pikachu pi pikachu pi pi pika pi pikachu pika pi pi pika pikachu pi pikachu pi pi pikachu pikachu pika pikachu pikachu pika pi pikachu pi pika pikachu pi pikachu pika pika pikachu pika pi pi pikachu pikachu pika pika pikachu pi pika pikachu pikachu pi pika pikachu pikachu pika pi pi pikachu pikachu pi pikachu pi pikachu pi pikachu pi pika pikachu pi pikachu pika pikachu pi pika pi pikachupi pikapikachu pikachu pi pikachupika pipikachu pikachu pi pikachupikachu pi pikachu pi pi pikachu pi pikachu pika pikachu pikachu pi pikachu pikachu pika pi pi pika pikachu pika pikachu pi pi pikachu pika pi pi pikachu pika pika pi pika pika pikachu pika pikachu pi pi pika pikachu pika pi pikachu pikachu pi pikachu pika pikachu pikachu pika pi pi pikachu pikachu pi pika pikachu pi pikachu pika pikachu pikachu pika pi pikachu pikachu pika pikachu pi pikachu pika pika pi pikachu pi pika pi pikachu pikachu pi pikachupi pikapikachu pikachu pi pikachupikachu pikachu pi pika pikachu pi pika pika pi pi pika pi pikachu pi pika pi pika pi pika pikachu pika pi pi pikachu pi pikachu pi pika pi pika pika pikachu pi pikachupikachu pikachu pi pikachupikachu pi pikachu pika pikachu pi pika pi pikachu pikachu pika pika pi pi pikachu pi pika pi pikachu pi pika pikachu pi pika pi pi pikachu pikachu pika pika pikachu pikachu pi pi pikachu pi pikachu pi pikachu pi pi pikachu pikachu pi pikachu pi pikachu pi pika pika pikachu pikachu pika pi pika pikachu pi pikachu pi pi pika pikachu pika pi pikachu pi pika pi pi pikachu pikachu pika pika pikachu pika pika pikachu pi pika pi pika pikachu pi pika pikachu pika pi pika pikachupikachu pikachu pika pikachupikachu pikachu pika pikachupi pi pikachu pi pikachu pika pika pi pikachu pika pika pi pi pika pika pikachu pi pi pikachu pi pika pi pika pikachu pi pikachu pi pikachu pikachu pi pi pika pika pi pika pika pi pika pikachu pikachu pi pikachu pika pi pi pika pi pi pikachu pikachu pika pi pi pika pika pi pika pikachu pi pikachu pi pi pika pi pika pika pikachu pika pi pika pikachu pi pikachu pikachu pi pi pika pi pika pika pikachu pikachu pi pikachupikachu pikachu pi pikachupikachu pi pikachu pikachu pika pikachu pikachu pika pika pikachu pikachu pika pikachu pi pika pikachu pika pika pi pikachu pi pi pika pi pi pikachu pika pika pikachu pikachu pika pikachu pikachu pi pika pi pi pikachu pikachu pika pi pi pikachu pikachu pika pikachu pika pi pikachu pi pika pi pika pikachu pika pi pikachu pi pikachu pikachu pi pika pikachu pi pikachu pikachu pi pika pi pikachu pikachu pi pikachu pika pika pi pi pikachupikachu 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 pikachupikachu pikachu pi pikachupikachu pikachu pika pikachu

Pike

int main(){   write("Hello world!\n");}

PILOT

T:Hello world!

PIR

.sub hello_world_text :mainprint "Hello world!\n".end

Pixilang

fputs("Hello world!\n")

PL/I

goodbye:proc options(main);     put list('Hello world!');end goodbye;

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.

100H:   /* CP/M BDOS SYSTEM CALL */   BDOS: PROCEDURE( FN, ARG ); DECLARE FN BYTE, ARG ADDRESS; GOTO 5; END;   /* PRINT A $ TERMINATED STRING */   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

PL/SQL

Works with:Oracle
set serveroutput onBEGIN  DBMS_OUTPUT.PUT_LINE('Hello world!');END;/
SQL> set serveroutput onSQL> SQL> BEGIN  2    DBMS_OUTPUT.PUT_LINE('Hello world!');  3  END;  4  /Hello world!                                                                    PL/SQL procedure successfully completed.

Plain English

\This prints Hello World within the CAL-4700 IDE.\...and backslashes are comments!To run:Start up.Write "Hello World!" to the console.Wait for the escape key.Shut down.

Plan

This prints HELLO WORLD on operator's console.

#STEER         LIST,BINARY#PROGRAM       HLWD#LOWERMSG1A          11HHELLO WORLDMSG1B          11/MSG1A#PROGRAM#ENTRY         0      DISTY    MSG1B      SUSWT    2HHH#END#FINISH#STOP

Pluto

print "Hello world!"

Pointless

output = println("Hello world!")

Pony

actor Main  new create(env: Env) =>    env.out.print("Hello world!")

Pop11

printf('Hello world!\n');

Portugol

Portugol keywords are Portuguese words.

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    }}

PostScript

To generate a document that shows the text "Hello world!":

%!PS/Helvetica 20 selectfont70 700 moveto(Hello world!) showshowpage

If the viewer has a console, then there are the following ways to display the topmost element of the stack:

(Hello world!) ==

will display thestring "(Hello world!)";

(Hello world!) =

will display thecontent of the string "(Hello world!)"; that is, "Hello world!";

(Hello world!) print

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:

%!PS/Helvetica 20 selectfont70 700 moveto(Hello world!) dup dup dup= print == % prints three times to the consoleshow % prints to document1 0 div % provokes error messageshowpage

Potion

"Hello world!\n" print

PowerBASIC

#COMPILE EXE#COMPILER PBCC 6FUNCTION PBMAIN () AS LONG  CON.PRINT "Hello world!"  CON.WAITKEY$END FUNCTION

PowerShell

This example used to say that usingWrite-Host was good practice. This is not true - it should in fact be avoided in most cases.

Seehttp://www.jsnover.com/blog/2013/12/07/write-host-considered-harmful/ (Jeffrey Snover is one of the creators of PowerShell).

'Hello world!'

Processing

println("Hello world!");

ProDOS

printline Hello world!

Programming Language

For typing:

print(Hello world!)

For importing:

[print(Hello world!)]

ProgressBASIC

10 PRINT "Hello world"

Prolog

:- write('Hello world!'), nl.

PROMAL

program helloinclude librarybeginoutput "Hello world!"end

PSQL

 EXECUTE BLOCK   RETURNS(S VARCHAR(40)) AS BEGIN   S = 'Hello world!';   SUSPEND; END

Pure

using system;puts "Hello world!\n" ;

PureBasic

OpenConsole()PrintN("Hello world!")Input() ; Wait for enter

usingDebug

Debug("Hello world!")

Python

Works with:Python version 2.4
print "Hello world!"

The same using sys.stdout

import syssys.stdout.write("Hello world!\n")

In Python 3.0, print is changed from a statement to a function.

Works with:Python version 3.0

(And version 2.X too).

print("Hello world!")

An easter eggThe first two examples printHello, world! once, and the last one prints it twice.

import __hello__
import __phello__
import __phello__.spam

QB64

PRINT "Hello world!"

Quackery

say "Hello world!"

Quill

"Hello world!" print

Quite BASIC

10 print "Hello world!"

R

 cat("Hello world!\n")

or

 message("Hello world!")

or

 print("Hello world!")

Ra

class HelloWorld**Prints "Hello world!"**on startprint "Hello world!"

Racket

(printf "Hello world!\n")

Raku

(formerly Perl 6)

say 'Hello world!';

In an object-oriented approach, the string is treated as an object calling itssay() method:

"Hello, World!".say();

Raven

'Hello world!' print

RATFOR

program hellowrite(*,101)"Hello World"101 format(A)end


RASEL

A"!dlroW ,olleH">:?@,Hj

REALbasic

Works with:REALbasic version 5.5

This requires a console application.

Function Run(args() as String) As Integer  Print "Hello world!"  QuitEnd Function

Rebol

print "Hello world!"

RED

print "Hello world!"

Refal

$ENTRY Go {    = <Prout 'Hello, world!'>;};

Relation

' Hello world!

ReScript

Js.log("Hello world!")
Output:
$ bsc hello.res > hello.bs.js$ node hello.bs.jsHello world!

Retro

'Hello_world! s:put nl

REXX

using SAY

/*REXX program to show a line of text.  */say 'Hello world!'

using SAY variable

/*REXX program to show a line of text.  */yyy = 'Hello world!'say yyy

using LINEOUT

/*REXX program to show a line of text.  */call lineout ,"Hello world!"

Rhombus

print("Hello world!")

Rhovas

print("Hello world!");

Ring

See "Hello world!"

RISC-V Assembly

.datahello:.string "Hello World!\n\0".textmain:la a0, helloli a7, 4ecallli a7, 10ecall

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 pfmain =    Stdout.line "I'm a Roc application!"

Rockstar

Shout "Hello world!"

Rocq

Require Import Coq.Strings.String.Eval compute in ("Hello world!"%string).

RPG

**free
dsply 'Hello World!';

RPL

≪ "Hello world!" ≫ 'TASK' STO
Output:
1: "Hello world!"

RTL/2

TITLE Goodbye World;LET NL=10;EXT PROC(REF ARRAY BYTE) TWRT;ENT PROC RRJOB()INT;    TWRT("Hello world!#NL#");    RETURN(1);ENDPROC;

Ruby

Works with:Ruby version 1.8.4
puts "Hello world!"

or

$stdout.puts "Hello world!"

or even

 STDOUT.write "Hello world!\n"


Using the > global

$>.puts "Hello world!"
$>.write "Hello world!\n"

Run BASIC

print "Hello world!"

Rust

fn main() {   print!("Hello world!");}

or

fn main() {   println!("Hello world!");}

Rye

Works with:Rye version 0.0.97
print "Hello world!"

Salmon

"Hello world!"!

or

print("Hello world!\n");

or

standard_output.print("Hello world!\n");

SapbotVM

SVM1

[    "DEBUG;THello, World!"]

SVM2

# Simple Hello World program in SVM2 format10 DEBUG;Thello World

SAS

/* Using a data step. Will print the string in the log window */data _null_;put "Hello world!";run;

SASL

Note that a string starts with a single and ends with a double quote

'Hello World!",nl

Sather

class GOODBYE_WORLD is main is   #OUT+"Hello world!\n";  end; end;

Scala

Library:Console

Ad hoc REPL solution

Ad hoc solution asREPL script. Type this in a REPL session:

println("Hello world!")

Via Java runtime

This is a call to the Java run-time library.Not recommended.

System.out.println("Hello world!")

Via Scala Console API

This is a call to the Scala run-time library.Recommended.

println("Hello world!")

Short term deviation to out

Console.withErr(Console.out) { Console.err.println("This goes to default _out_") }

Long term deviation to out

  Console.err.println ("Err not deviated")  Console.setErr(Console.out)  Console.err.println ("Err deviated")  Console.setErr(Console.err) // Reset to normal

Scheme

All Scheme implementations display the value of the last evaluated expression before the program terminates.

"Hello world!"

Thedisplay andnewline procedures are found in specific modules of the standard library in R6RS and R7RS.The previous standards have no concept of modules and the entirety of the standard library is loaded by default.

R5RS

(display "Hello world!")(newline)

R6RS

(import (rnrs base (6))        (rnrs io simple (6)))(display "Hello world!")(newline)

R7RS

(import (scheme base)        (scheme write))(display "Hello world!")(newline)

Scilab

disp("Hello world!");

ScratchScript

print "Hello world!"

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.

print "Hello world!"delayOnClick

sed

i\Hello world!q

Seed7

$ include "seed7_05.s7i";const proc: main is func  begin    writeln("Hello world!");  end func;

Self

'Hello world!' printLine.

SenseTalk

put "Hello world!"

Set lang

set ! Hset ! Eset ! Lset ! Lset ! Oset ! 32set ! Wset ! Oset ! Rset ! Lset ! Dset ! 33

SETL

print("Hello world!");

SETL4

out("Hello world!");end

Shen

(output "Hello world!~%")

Shiny

say 'Hello world!'

Sidef

„Hello world!”.say;

SIL

printLine Hello world!

SimpleCode

The letters are only outputted in uppercase in the running program. However, lowercase characters can be used in the code instead.

dtxtHello world!

SIMPOL

function main()end function "Hello world!{d}{a}"

Simula

Works with:SIMULA-67
BEGIN   OUTTEXT("Hello world!");   OUTIMAGEEND

Sing

requires "sio";public fn singmain(argv [*]string) i32{    sio.print("hello world !\r\n");    return(0);}

Sisal

define main% Sisal doesn't yet have a string built-in.% Let's define one as an array of characters.type string = array[character];function main(returns string)  "Hello world!"end function

Skew

Works with:skewc version 0.9.19
@entrydef main {  dynamic.console.log("Hello world!")}

SkookumScript

print("Hello world!")

Alternatively if just typing in the SkookumIDEREPL:

"Hello world!"

Slate

inform: 'Hello world!'.

Slope

(write "Hello, world!")

SmallBASIC

PRINT "Hello world!"

Smalltalk

Transcript show: 'Hello world!'; cr.
Works with:GNU Smalltalk

(as does the above code)

'Hello world!' printNl.

smart BASIC

PRINT "Hello world!"

SmileBASIC

PRINT "Hello world!"

SNOBOL4

Using CSnobol4 dialect

    OUTPUT = "Hello world!"END

SNUSP

Core SNUSP

/++++!/===========?\>++.>+.+++++++..+++\\+++\ | /+>+++++++>/ /++++++++++<<.++>./$+++/ | \+++++++++>\ \+++++.>.+++.-----\      \==-<<<<+>+++/ /=.>.+>.--------.-/

Modular SNUSP

@\G.@\o.o.@\d.--b.@\y.@\e.>@\comma.@\.<-@\W.+@\o.+++r.------l.@\d.>+.! # |   |     \@------|#  |    \@@+@@++|+++#-    \\               - |   \@@@@=+++++#  |   \===--------!\===!\-----|-------#-------/ \@@+@@@+++++#     \!#+++++++++++++++++++++++#!/

Soda

class Main  main (arguments : Array [String] ) : Unit =    println ("Hello world!")end

SoneKing Assembly

extern printdv Msg Goodbye,World!mov eax Msgpushcall printpop

SPARC Assembly

.section".text".global_start_start:mov4,%g1! 4 is SYS_writemov1,%o0! 1 is stdoutset.msg,%o1! pointer to buffermov(.msgend-.msg),%o2! lengthta8mov1,%g1! 1 is SYS_exitclr%o0! return status is 0ta8.msg:.ascii"Hello world!\n".msgend:

Sparkling

print("Hello world!");

SPL

#.output("Hello world!")

SQL

Works with:Oracle
Works with:Db2 LUW
select 'Hello world!' text from dual;
SQL>select 'Hello world!' text from dual;TEXT------------Hello world!

SQL PL

Works with:Db2 LUW

With SQL only:

SELECT 'Hello world!' AS text FROM sysibm.sysdummy1;

Output:

db2 -tdb2 => SELECT 'Hello world!' AS text FROM sysibm.sysdummy1;TEXT        ------------Hello world!  1 record(s) selected.
Works with:Db2 LUW

version 9.7 or higher.

With SQL PL:

SET SERVEROUTPUT ON;CALL DBMS_OUTPUT.PUT_LINE('Hello world!');

Output:

db2 -tdb2 => SET SERVEROUTPUT ONDB20000I  The SET SERVEROUTPUT command completed successfully.db2 => CALL DBMS_OUTPUT.PUT_LINE('Hello world!')  Return Status = 0Hello world!

Standard ML

print "Hello world!\n"

Stata

display "Hello world!"

Stax

Compressed string literal.

`dx/&\p4`A+

Suneido

Print("Hello world!")

Swahili

andika("Hello world!")

Swift

Works with:Swift version 2.x+
print("Hello world!")
Works with:Swift version 1.x
println("Hello world!")

Symsyn

 'hello world' []

TailDot

c,x,Hello World!,v,x

Tailspin

'Hello World' -> !OUT::write

In v0.5 you could still send to OUT or just emit the value:

'Hello World' !

TAV

 \( The famous example \) main (parms):+   print "Greetings from TAV"

Tcl

Output to terminal:

puts stdout {Hello world!}

Output to arbitrary open, writable file:

puts $fileID {Hello world!}

Teco

Outputting to terminal. Please note that ^A means control-A, not a caret followed by 'A', and that $ represent the ESC key.

^AHello world!^A$$

Tern

println("Hello world!");

Terra

C = terralib.includec("stdio.h")terra hello(argc : int, argv : &rawstring)  C.printf("Hello world!\n")  return 0end

Terraform

output "result" {  value = "Hello world!"}
Output:
$ terraform init$ terraform applyApply complete! Resources: 0 added, 0 changed, 0 destroyed.Outputs:result = Hello world!$ terraform output resultHello world!

TestML

%TestML 0.1.0Print("Hello world!")

TI-57

0.7745

You must then turn the calculator upside down to read the text:screenshot

TI-83 BASIC

Disp "Hello world!

(Lowercase letters DO exist in TI-BASIC, though you need an assembly program to enable them.)

TI-89 BASIC

Disp "Hello world!"

Tiny BASIC

Works with:TinyBasic
10 PRINT "Hello, World!"20 END

TMG

Unix TMG:

begin: parse(( = { <Hello, World!> * } ));

TorqueScript

echo("Hello world!");

TPP

Hello world!

Transact-SQL

PRINT "Hello world!"

Transd

(textout "Hello, World!")

TransFORTH

PRINT " Hello world! "

Trith

"Hello world!" print

True BASIC

! In True BASIC all programs run in their own window. So this is almost a graphical version.PRINT "Hello world!"END

TUSCRIPT

$$ MODE TUSCRIPTPRINT "Hello world!"

Output:

Hello world!

uBasic/4tH

Print "Hello world!"

Uiua

&p"Hello world!"

Uniface

message "Hello world!"

Unison

main = '(printLine "Hello world!")

UNIX Shell

Works with:Bourne Shell
#!/bin/shecho "Hello world!"

C Shell

#!/bin/csh -fecho "Hello world!\!"

We use \! to prevent history substitution. Plain ! at end of string seems to be safe, but we use \! to be sure.

Unlambda

`r```````````````.G.o.o.d.b.y.e.,. .W.o.r.l.d.!i

Ursa

out "hello world!" endl console

Ursala

output as a side effect of compilation

#show+main = -[Hello world!]-

output by a compiled executable

#import std#executable ('parameterized','')main = <file[contents: -[Hello world!]-]>!

Ursalang

print("hello woods!")

உயிர்/Uyir

முதன்மை என்பதின் வகை எண் பணி {{         ("உலகத்தோருக்கு வணக்கம்") என்பதை திரை.இடு;         முதன்மை = 0;}};

Uxntal

|10 @Console &vector $2 &read $1 &pad $5 &write $1 &error $1|100@on-reset ( -> );my-string print-textBRK@print-text ( str* -- )&whileLDAk .Console/write DEOINC2 LDAk ?&whilePOP2JMP2r@my-string"Hello 20 "World! 0a00
Output:
Hello World!

V

"Hello world!" puts

Vala

void main(){stdout.printf("Hello world!\n");}

Vale

Works with:Vale version 0.2.0
import stdlib.*;exported func main() {println("Hello world!");}

VAX Assembly

desc:  .ascid "Hello World!"      ;descriptor (len+addr) and text.entry hello, ^m<>                ;register save mask       pushaq desc                ;address of descriptor       calls #1, g^lib$put_output ;call with one argument on stack       ret                        ;restore registers, clean stack & return.end hello                        ;transfer address for linker

VBA

Public Sub hello_world_text    Debug.Print "Hello World!"End Sub


VBScript

Works with:Windows Script Host version 5.7
WScript.Echo "Hello world!"

Vedit macro language

Message("Hello world!")

Verbexx

@SAY "Hello world!";


Verilog

module main;  initial begin      $display("Hello world!");      $finish ;    endendmodule

VHDL

LIBRARY std;USE std.TEXTIO.all;entity test isend entity test;architecture beh of test isbegin  process    variable line_out : line;  begin    write(line_out, string'("Hello world!"));    writeline(OUTPUT, line_out);    wait; -- needed to stop the execution  end process;end architecture beh;

Vim Script

echo "Hello world!\n"

Visual Basic

Library:Microsoft.Scripting
Works with:Visual Basic version 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.

Option ExplicitPrivate Declare Function AllocConsole Lib "kernel32.dll" () As LongPrivate Declare Function FreeConsole Lib "kernel32.dll" () As Long'needs a reference set to "Microsoft Scripting Runtime" (scrrun.dll)Sub Main()  Call AllocConsole  Dim mFSO As Scripting.FileSystemObject  Dim mStdIn As Scripting.TextStream  Dim mStdOut As Scripting.TextStream  Set mFSO = New Scripting.FileSystemObject  Set mStdIn = mFSO.GetStandardStream(StdIn)  Set mStdOut = mFSO.GetStandardStream(StdOut)  mStdOut.Write "Hello world!" & vbNewLine  mStdOut.Write "press enter to quit program."  mStdIn.Read 1  Call FreeConsoleEnd Sub

Visual Basic .NET

Imports SystemModule HelloWorld    Sub Main()        Console.WriteLine("Hello world!")    End SubEnd Module

Viua VM assembly

.function: main/0    text %1 local "Hello World!"    print %1 local    izero %0 local    return.end

V (Vlang)

println('Hello World!')

VTL-2

10 ?="Hello world!"

Waduzitdo

T:Hello world!S:

Wart

prn "Hello world!"

WDTE

io.writeln io.stdout 'Hello world!';

WebAssembly

Library:WASI
(module $helloworld    ;;Import fd_write from WASI, declaring that it takes 4 i32 inputs and returns 1 i32 value    (import "wasi_unstable" "fd_write"        (func $fd_write (param i32 i32 i32 i32) (result i32))    )    ;;Declare initial memory size of 32 bytes    (memory 32)    ;;Export memory so external functions can see it    (export "memory" (memory 0))     ;;Declare test data starting at address 8    (data (i32.const 8) "Hello world!\n")     ;;The entry point for WASI is called _start    (func $main (export "_start")                ;;Write the start address of the string to address 0        (i32.store (i32.const 0) (i32.const 8))          ;;Write the length of the string to address 4        (i32.store (i32.const 4) (i32.const 13))        ;;Call fd_write to print to console        (call $fd_write            (i32.const 1) ;;Value of 1 corresponds to stdout            (i32.const 0) ;;The location in memory of the string pointer            (i32.const 1) ;;Number of strings to output            (i32.const 24) ;;Address to write number of bytes written        )        drop ;;Ignore return code    ))

Wee Basic

print 1 "Hello world!"end

Whenever

1 print("Hello world!");

Whiley

import whiley.lang.Systemmethod main(System.Console console):    console.out.println("Hello world!")

Whitespace

There is a "Hello World" - example-program on theWhitespace-website

Wisp

Output in Wisp follows the same concepts asScheme, but replacing outer parentheses with indentation.

WithGuile and wisp installed, this example can be tested in a REPL started with guile --language=wisp, or directly with the command wisp.

import : scheme base         scheme writedisplay "Hello world!"newline

Wolfram Language

Print["Hello world!"]

Wren

System.print("Hello world!")

X10

class HelloWorld {  public static def main(args:Rail[String]):void {    if (args.size < 1) {        Console.OUT.println("Hello world!");        return;    }  }}

X86 Assembly

Works with:nasm version 2.05.01

This is known to work on Linux, it may or may not work on other Unix-like systems

Prints "Hello world!" to stdout (and there is probably an even simpler version):

section .datamsg     db      'Hello world!', 0AHlen     equ     $-msgsection .textglobal  _start_start: mov     edx, len        mov     ecx, msg        mov     ebx, 1        mov     eax, 4        int     80h        mov     ebx, 0        mov     eax, 1        int     80h

AT&T syntax: works with gcc (version 4.9.2) and gas (version 2.5):

.section .text.globl mainmain:movl $4,%eax#syscall number 4movl $1,%ebx#number 1 for stdoutmovl $str,%ecx#string pointermovl $16,%edx#number of bytesint $0x80#syscall interruptret.section .datastr: .ascii "Hello world!\12"

X86-64 Assembly

UASM

option casemap:noneif @Platform eq 1   option dllimport:<kernel32>      ExitProcess   proto :dword   option dllimport:none      exit          equ ExitProcessendifprintf              proto :qword, :varargexit                proto :dword.codemain procinvoke printf, CSTR("Goodbye, World!",10)invoke exit, 0retmain endpend

AT&T syntax (Gas)

// No "main" used// compile with `gcc -nostdlib`#define SYS_WRITE   $1#define STDOUT      $1#define SYS_EXIT    $60#define MSGLEN      $14.global _start.text_start:    movq    $message, %rsi          // char *    movq    SYS_WRITE, %rax    movq    STDOUT, %rdi    movq    MSGLEN, %rdx    syscall                         // sys_write(message, stdout, 0x14);        movq    SYS_EXIT, %rax    xorq    %rdi, %rdi              // The exit code.    syscall                         // exit(0)    .datamessage:    .ascii "Hello, world!\n"

NASM

; compile with:; nasm -f elf64 hello0.asm -o hello0.o; ld hello0.o -o hello0 -z noexecstack -no-pie -sglobal _startsection .text_start: .write:    mov    rax,    1    mov    rdi,    1    mov    rsi,    message    mov    rdx,    14    syscall .exit:    mov    rax,    60    xor    rdi,    rdi    syscallsection .datamessage: db "Hello, World!", 0x0a

Using C library:

; compile with:; nasm -f elf64 hello1.asm -o hello1.o; gcc hello1.o -o hello1 -z noexecstack -no-pie -s; or; tcc hello1.o -o hello1global mainextern putssection .textmain:    mov    rdi,    message    sub    rsp,    8    call   puts    add    rsp,    8    xor    rax,    rax    retsection .datamessage: db "Hello, World!", 0

We don't need no stinkin' data segment!
Push it to the stack!

global _startsection .text_start:    mov  rdi, `Hello, W`    mov  rax, `orld!\n\0\0`    push rax    push rdi    mov  rax,    1    mov  rdi,    1    mov  rsi,    rsp    mov  rdx,    14    syscall    pop  rdi    pop  rax    mov  rax,    60    mov  rdi,    0    syscall

FASM

FASM syntax is similar to NASM, but it's powerful metaprogramming capabilities allows for more convenient syntax and higher level semantics.

Linux

;compile with:    fasm hello.asm hello;                 chmod 755 hello;run with:        ./helloformat ELF64 executable 3            ; Linux 64 bit executableentry _start                         ; label to start executionsegment executable readable          ; code segment_start:  .write:    mov    rax, 1                    ; sys_write    mov    rdi, 1                    ; stdout    mov    rsi, message              ; pointer to string to write    mov    rdx, endmessage - message ; length of string    syscall                          ; print the string  .exit:    mov    rax, 60                   ; sys_exit    xor    rdi, rdi                  ; exit code 0    syscall                          ; exit programsegment readable writable            ; 'data' segmentmessage: db "Hello, World!"          ; message to print         db 0x0a                     ; line feedendmessage:                          ; endmessage - message = length

Windows

format PE consoleentry startinclude 'win32ax.inc'section '.rdata' data readable  message       db 'Hello, World!', 13, 10  ; `=` is used to define the constant. `$` is the address of current position  message_len   = $ - messagesection '.code' code readable executable  ; `invoke <PROC>, <...ARGS>` is a macro, equivalent to pushing arguments on the stack and `call`ing the procedure   start:    ; Get a handle to standard output. Result is stored in EAX.    invoke GetStdHandle, \   ; https://learn.microsoft.com/en-us/windows/console/getstdhandle       STD_OUTPUT_HANDLE ; -11    ; Print the message to the console using the handle from EAX    invoke WriteConsoleA, \ ; https://learn.microsoft.com/en-us/windows/console/writeconsole       eax,  \ ; HANDLE  hConsoleOutput       message,   \; void    *lpBuffer       message_len,   \; DWORD   nNumberOfCharsToWrite       NULL,          \; LPDWORD lpNumberOfCharsWritten (optional)       NULL; void    *lpReserved  (must be null)    ; Exit the program    invoke ExitProcess, 0; Import Section (used to interface with dynamic libraries)section '.idata' import data readable  ; `library` is a macro that must be placed directly in the beginning of the import data.  ; It defines from what libraries the functions will be imported.  ; It should be followed by any amount of the pairs of parameters,   ; each pair being the label for the table of imports from the given library,   ; and the quoted string defining the name of the library.  library kernel32, 'kernel32.dll'  ; `import` macro generates the import table.   ; It needs first parameter to define the label for the table (the same as declared earlier to the library macro),  ; and then the pairs of parameters each containing the label for imported pointer and the quoted string  ; defining the name of function exactly as exported by library.  import kernel32,                       \         GetStdHandle,  'GetStdHandle',  \         WriteConsoleA, 'WriteConsoleA', \         ExitProcess,   'ExitProcess'

XBasic

Works with:Windows XBasic
PROGRAM "hello"VERSION "0.0003"DECLARE FUNCTION Entry()FUNCTION Entry()  PRINT "Hello World"END FUNCTIONEND PROGRAM

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

XL

use XL.UI.CONSOLEWriteLn "Hello world!"

XLISP

(DISPLAY "Hello world!")(NEWLINE)

XPL0

code Text=12;Text(0, "Hello world!")

XPath

'Hello world&#xA;'

XSLT

With a literal newline:

<xsl:text>Hello world!</xsl:text>

Or, with an explicit newline:

<xsl:text>Hello world!&#xA;</xsl:text>

Yabasic

print "Hello world!"

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.

!YS-v0say: "Hello, world!"=>: (say "Hello, world!")=>: say("Hello, world!")say:  =>: "Hello, world!"say: ("Hello, " + "world!")say: ."Hello," "world!"say "Hello,": "world!"say "Hello," "world!":
Output:
$ ys hello-world-text.ys Hello, world!Hello, world!Hello, world!Hello, world!Hello, world!Hello, world!Hello, world!

Yorick

write, "Hello world!"

Z80 Assembly

Using the Amstrad CPC firmware:

org$4000txt_output:equ$bb5apushhlldhl,worldprint:lda,(hl)cp0jrz,endcalltxt_outputinchljrprintend:pophlretworld:defm"Hello world!\r\n\0"

zkl

println("Hello world!");

Zig

Works with: 0.13.0

const std = @import("std");pub fn main() !void {    const stdout = std.io.getStdOut();    try stdout.writeAll("Hello world!\n");}

Zoea

program: hello_world   output: "Hello  world!"

Zoea Visual

Hello World

Zoomscript

For typing:

print "Hello world!"

For importing:

¶0¶print "Hello world!"

ZX Spectrum Basic

10 print "Hello world!"
Retrieved from "https://rosettacode.org/wiki/Hello_world/Text?oldid=396462"
Categories:
Hidden category:
Cookies help us deliver our services. By using our services, you agree to our use of cookies.

[8]ページ先頭

©2009-2026 Movatter.jp