Hello world/Text: Difference between revisions

m
Fix issues with mastermind language example.
m (→‎{{header|Pointless}}: Used the wrong function, sorry)
m (Fix issues with mastermind language example.)
(48 intermediate revisions by 33 users not shown)
Line 44:
BR 14 Return
END
</syntaxhighlight>
 
=={{header|IBM Z HL/ASM}}==
Using Modern IBM Z High Level assembler to write 'Hello World' to the Unix System Services 'stdout' file descriptor
<syntaxhighlight lang="360 assembly">
PRINT ON,GEN,DATA
HELLO CSECT
HELLO RMODE ANY
HELLO AMODE 31
*
* Prolog
*
SAVE (14,12)
BASR R12,0
USING *,R12
STORAGE OBTAIN,LENGTH=DYNL,ADDR=(R11)
USING DYNAREA,R11
 
LA R2,DSA
ST R2,8(,R13)
ST R13,DSA+4
LR R13,R2
*
* Body
* Write Hello World to STDOUT
*
 
*
* Store values into parameter list
*
MVC REC(HWL),HW
LA R1,REC
ST R1,RECA
LA R1,HWL
ST R1,RECL
L R1,STDOUT
ST R1,FD
L R1,BPXALET
ST R1,ALET
 
CALL BPX1WRT,(FD, x
RECA, x
ALET, x
RECL, x
RV, x
RC, x
RN),MF=(E,BPXWRTD)
 
L R8,RV
L R9,RC
L R10,RN
*
* Epilog
*
L R13,DSA+4
STORAGE RELEASE,LENGTH=DYNL,ADDR=(R11)
RETURN (14,12),RC=0
 
*
* Statics, Dynamic Storage, Equates follows
*
* Naming convention:
* Suffixes:
* L : length
* S : static
* D : dynamic
* A : address
 
LTORG
*
* Statics (constants)
*
STDIN DC F'0'
STDOUT DC F'1'
STDERR DC F'2'
BPXALET DC F'0'
BPX1WRT DC V(BPX1WRT)
 
BPXWRTS CALL ,(0,0,0,0,0,0,0),MF=L
BPXWRTL EQU *-BPXWRTS
 
HW DC C'Hello World'
NEWLINE DC X'15'
HWL EQU *-HW
 
*
* Dynamic (storage obtain'ed) area
*
DYNAREA DSECT
*
* Dynamic Save Area regs always first
*
DSA DS 18F
 
*
* Working storage
*
FD DS F
 
RECSIZE EQU RECEND-*
REC DS CL80
RECEND EQU *
RECA DS A
BPXWRTD DS CL(BPXWRTL)
ALET DS F
RECL DS F
RV DS F
RC DS F
RN DS F
 
DYNL EQU *-DYNAREA
*
*
* End of working storage
*
 
*
* Equates
*
R0 EQU 0
R1 EQU 1
R2 EQU 2
R3 EQU 3
R4 EQU 4
R5 EQU 5
R6 EQU 6
R7 EQU 7
R8 EQU 8
R9 EQU 9
R10 EQU 10
R11 EQU 11
R12 EQU 12
R13 EQU 13
R14 EQU 14
R15 EQU 15
END
</syntaxhighlight>
 
Line 186 ⟶ 322:
<syntaxhighlight lang="lisp">(cw "Hello world!~%")</syntaxhighlight>
 
=={{header|Acornsoft Lisp}}==
 
Since there is no string data type in the language, a symbol (an identifier or 'character atom') must be used instead. When writing a symbol in source code, exclamation mark is an escape character that allows characters such as spaces and exclamation marks to be treated as part of the symbol's name. Some output functions will include exclamation mark escapes when outputting such symbols, and others, such as <code>printc</code>, will not.
 
<syntaxhighlight lang="lisp">(printc 'Hello! world!!)</syntaxhighlight>
 
The single quote in front of <code>Hello! world!!</code> makes it an expression that evaluates to the symbol itself; otherwise, it would be treated as a variable and its value (if it had one) would be printed instead.
 
=={{header|Action!}}==
Line 351 ⟶ 494:
mov r7, #1
swi 0</syntaxhighlight>
 
Alternative versions
 
<pre>
Developed on an Acorn A5000 with RISC OS 3.10 (30 Apr 1992)
Using the assembler contained in ARM BBC BASIC V version 1.05 (c) Acorn 1989
 
The Acorn A5000 is the individual computer used to develop the code,
the code is applicable to all the Acorn Risc Machines (ARM)
produced by Acorn and the StrongARM produced by digital.
 
In the BBC BASIC part of the program I have included:
OS_WriteC = &00
OS_WriteO = &02
OS_NewLine = &03
this is so I can write SWI OS_WriteC etc instead of SWI &0 to make the assembler more legible
 
(a) method1 - output the text character by character until the terminating null (0) is seen
 
.method1_vn00
ADR R8 , method1_string \ the ARM does not have an ADR instruction
\ the assembler will work out how far the data item
\ is from here (in this case a +ve relative offset)
\ and so will produce an ADD R8 , PC, offset to method1_string
\ a magic trick by the ARM assembler
 
.method1_loop
LDRB R0 , [R8], #1 \ load the byte found at address in R8 into R0
\ then post increment the address in R8 in preparation
\ for the next byte (the #1 is my choice for the increment)
CMP R0 , #0 \ has the terminating null (0) been reached
SWINE OS_WriteC \ when not the null output the character in R0
\ (every opportunity to have a SWINE in your program should be taken)
BNE method1_loop \ go around the loop for the next character if not reached the null
 
SWI OS_NewLine \ up to you if you want a newline
 
MOVS PC , R14 \ return
\ when I call an operating system function it no longer operates
\ in 'user mode' and it has its own R14, and anyway the operating system
\ is too polite to write rubbish into this return address
 
 
.method1_string
EQUS "Hello world!" \ the string to be output
EQUB &00 \ a terminating null (0)
ALIGN \ tell the assembler to ensure that the next item is on a word boundary
 
 
 
 
(b) method2 - get the supplied operating system to do the work
 
.method2_vn00
ADR R0 , method2_string \ the ARM does not have an ADR instruction
\ the assembler will work out how far the data item
\ is from here (in this case a +ve relative offset)
\ and so will produce an ADD R0 , PC, offset to method2_string
\ a magic trick by the ARM assembler
 
SWI OS_WriteO \ R0 = pointer to null-terminated string to write
 
SWI OS_NewLine \ up to you if you want a newline
 
MOVS PC , R14 \ return
.method2_string
EQUS "hELLO WORLD!" \ the string to be output
EQUB &00 \ a terminating null (0)
ALIGN \ tell the assembler to ensure that the next item is on a word boundary
</pre>
 
=={{header|ArnoldC}}==
Line 452 ⟶ 666:
 
<syntaxhighlight lang="babel">"Hello world!" <<</syntaxhighlight>
 
=={{header|BabyCobol}}==
<syntaxhighlight lang="cobol">
* Since no quotes are used, two undeclared fields (variables) are printed.
* Their default values are their own names in uppercase.
IDENTIFICATION DIVISION.
PROGRAM-ID. USER OUTPUT.
PROCEDURE DIVISION.
DISPLAY HELLO WORLD.
</syntaxhighlight>
 
=={{header|Bait}}==
Line 472 ⟶ 696:
{{works with|Chipmunk Basic}}
{{works with|Commodore BASIC}}
{{works with|CZX Spectrum Basic}}
{{works with|GW-BASIC}}
{{works with|IS-BASIC}}
Line 481 ⟶ 704:
{{works with|MSX BASIC}}
{{works with|QBasic}}
{{works with|Quite BASIC}}
{{works with|Run BASIC}}
{{works with|Tiny BASIC}}
{{works with|ZX Spectrum Basic}}
<syntaxhighlight lang="qbasic">10 print "Hello world!"</syntaxhighlight>
 
Line 490 ⟶ 715:
{{works with|BaCon}} [[Category:BaCon]]
{{works with|BASIC256}}
{{works with|FreeBASIC}}
{{works with|IS-BASIC}}
{{works with|M2000 Interpreter}}
{{works with|QBasic}}
{{works with|QB64}}
{{works with|Script Basic}}
{{works with|SmallBASIC}}
{{works with|Yabasic}}
<syntaxhighlight lang="qbasic">PRINT "Hello world!"</syntaxhighlight>
Line 571 ⟶ 800:
=={{header|Binary Lambda Calculus}}==
As explained at https://www.ioccc.org/2012/tromp/hint.html
<syntaxhighlight lang="blc"pre> Hello world!</syntaxhighlightpre>
 
=={{header|Bird}}==
Line 631 ⟶ 860:
 
=={{header|bootBASIC}}==
<syntaxhighlight lang="bootbasicBASIC">10 print "Hello world!"</syntaxhighlight>
 
=={{header|BQN}}==
Line 742 ⟶ 971:
<syntaxhighlight lang="brlcad">
echo Hello world!
</syntaxhighlight>
 
=={{header|Bruijn}}==
 
Ignore stdin by not referring to the abstraction:
 
<syntaxhighlight lang="bruijn">
main ["Hello world!"]
</syntaxhighlight>
 
Line 1,102 ⟶ 1,339:
=={{header|Crystal}}==
<syntaxhighlight lang="ruby">puts "Hello world!"</syntaxhighlight>
 
=={{header|Curto}}==
<syntaxhighlight lang="curto">." Hola, mundo!"</syntaxhighlight>
 
=={{header|D}}==
Line 1,269 ⟶ 1,509:
<syntaxhighlight lang="dragon">
showln "Hello world!"
</syntaxhighlight>
 
=={{header|DreamBerd}}==
<syntaxhighlight lang="text">
print "Hello world!"!
</syntaxhighlight>
 
Line 1,329 ⟶ 1,574:
=={{header|EasyLang}}==
 
<syntaxhighlight lang="text">print "Hello world!"</syntaxhighlight>
print "Hello world!"
</syntaxhighlight>
 
=={{header|eC}}==
Line 1,477 ⟶ 1,724:
 
=={{header|Elena}}==
ELENA 46.x:
<syntaxhighlight lang="elena">public program()
{
console.writeLine:("Hello world!")
}</syntaxhighlight>
 
Line 1,783 ⟶ 2,030:
=={{header|GLBasic}}==
<syntaxhighlight lang="glbasic">STDOUT "Hello world!"</syntaxhighlight>
 
=={{header|Gleam}}==
<syntaxhighlight lang="gleam">
import gleam/io
 
pub fn main() {
io.println("Hello world!")
}
</syntaxhighlight>
 
=={{header|Glee}}==
Line 1,880 ⟶ 2,136:
=={{header|Hoon}}==
<syntaxhighlight lang="hoon">~& "Hello world!" ~</syntaxhighlight>
 
=={{header|Hopper}}==
<syntaxhighlight lang="csharp">program Hello
{
uses "/Source/Library/Boards/PiPico"
Hopper()
{
WriteLn("Hello world!");
loop
{
LED = !LED;
Delay(500);
}
}
}</syntaxhighlight>
 
{{out}}
In IDE, build hello.hs into hello.hexe, (press F7) and start debug (F5) or hm console monitor.
<pre>!> hello
Hello world!
</pre>
The language and runtime install verification message shows up on the monitor console. In keeping with most MCU introductions, the onboard Light Emitting Diode (LED) will then blink on and off at 1/2 second intervals, forever; ''(until power runs out, or explicit operator intervention)''.
 
=={{header|HPPPL}}==
Line 2,271 ⟶ 2,550:
 
<syntaxhighlight lang="kitten">"Hello world!" say</syntaxhighlight>
 
=={{header|KL1}}==
<syntaxhighlight lang="prolog>
:- module main.
 
main :-
unix:unix([stdio(normal(S))]),
S = [fwrite("Hello world\n")].
</syntaxhighlight>
 
=={{header|Koka}}==
Line 2,325 ⟶ 2,613:
 
=={{header|langur}}==
<syntaxhighlight lang="langur">writeln "yo, peepsHello"</syntaxhighlight>
 
=={{header|Lasso}}==
Line 2,676 ⟶ 2,964:
Hello world!
</syntaxhighlight>
 
=={{header|Mastermind}}==
<syntaxhighlight lang="mastermind">output "Hello world!\n";</syntaxhighlight>
 
=={{header|Mathcad}}==
Line 2,974 ⟶ 3,265:
Using <code>PRINT</code>:
<syntaxhighlight lang="ns-hubasic">10 PRINT "HELLO WORLD!"</syntaxhighlight>
 
=={{header|Nu}}==
<syntaxhighlight lang="nu">
print "Hello world!"
</syntaxhighlight>
 
=={{header|Nutt}}==
Line 3,113 ⟶ 3,409:
=={{header|Onyx}}==
<syntaxhighlight lang="onyx">`Hello world!\n' print flush</syntaxhighlight>
 
=={{header|Onyx (wasm)}}==
<syntaxhighlight lang="TS">
use core {printf}
main :: () {
printf("Hello world!");
}
</syntaxhighlight>
{{out}}
<pre>
Hello world!
</pre>
 
=={{header|OOC}}==
Line 3,157 ⟶ 3,465:
<pre>$ ol hello-Owl.scm
Hello world!</pre>
 
 
=={{header|Oxygene}}==
From [[wp:Oxygene (programming language)]]
<syntaxhighlight lang="oxygenepascal">
namespace HelloWorld;
Line 3,180 ⟶ 3,489:
end.
</syntaxhighlight>
{{out}}
<pre>
>HelloWorld.exe
Hello world!
</pre>
Line 3,681 ⟶ 3,990:
=={{header|RED}}==
<syntaxhighlight lang="red">print "Hello world!"</syntaxhighlight>
 
=={{header|Refal}}==
<syntaxhighlight lang="refal">$ENTRY Go {
= <Prout 'Hello, world!'>;
};</syntaxhighlight>
 
=={{header|Relation}}==
Line 3,718 ⟶ 4,032:
 
call lineout ,"Hello world!"</syntaxhighlight>
 
=={{header|Rhovas}}==
 
<syntaxhighlight lang="360 assembly">
print("Hello world!");
</syntaxhighlight>
 
=={{header|Ring}}==
Line 3,747 ⟶ 4,067:
=={{header|Rockstar}}==
<syntaxhighlight lang="rockstar">Shout "Hello world!"</syntaxhighlight>
 
=={{header|RPG}}==
<nowiki>**</nowiki>free<br>
dsply 'Hello World!';
 
=={{header|RPL}}==
≪ "Hello world!" 1 DISP
In RPL, the standard output console is the stack itself.
1 FREEZE <span style="color:grey">@ remove this line on HP-28 models</span>
≪ "Hello world!" ≫
≫ '<span style="color:blue">TASK</span>' STO
 
=={{header|RTL/2}}==
Line 3,985 ⟶ 4,310:
=={{header|Slope}}==
<syntaxhighlight lang="slope">(write "Hello, world!")</syntaxhighlight>
 
=={{header|SmallBASIC}}==
<syntaxhighlight lang="smallbasic">PRINT "Hello world!"</syntaxhighlight>
 
=={{header|Smalltalk}}==
Line 4,201 ⟶ 4,529:
20 END
</syntaxhighlight>
 
=={{header|Tiny Craft Basic}}==
<syntaxhighlight lang="basic">10 cls
20 print "Hello, World!"
30 shell "pause"</syntaxhighlight>
 
=={{header|TMG}}==
Line 4,288 ⟶ 4,611:
 
main = <file[contents: -[Hello world!]-]>!</syntaxhighlight>
 
=={{header|Ursalang}}==
<syntaxhighlight lang="ursa">print("hello woods!")</syntaxhighlight>
 
=={{header|உயிர்/Uyir}}==
Line 4,310 ⟶ 4,636:
@print-str ( str* -- )
&while
LDAk #18.Console/write DEO
INC2 LDAk ?&while
POP2
Line 4,529 ⟶ 4,855:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">System.print("Hello world!")</syntaxhighlight>
 
=={{header|X10}}==
Line 4,680 ⟶ 5,006:
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, sequences or scalars;
it is actually useful to support these variants.
 
<syntaxhighlight lang="yaml">
!yamlscript/v0
(println "Hello world!")
</syntaxhighlight>
 
say: "Hello, world!"
<syntaxhighlight lang="yaml">
(say "Hello world!")
</syntaxhighlight>
 
=>: (say "Hello, world!")
<syntaxhighlight lang="yaml">
say("Hello world!")
</syntaxhighlight>
 
=>: say("Hello, world!")
<syntaxhighlight lang="yaml">
say("Hello world!"):
</syntaxhighlight>
 
<syntaxhighlight lang="yaml">
say:
- =>: "Hello, world!"
</syntaxhighlight>
 
say: ("Hello, " + "world!")
<syntaxhighlight lang="yaml">
say: ["Hello world!"]
</syntaxhighlight>
 
say: ."Hello," "world!"
<syntaxhighlight lang="yaml">
say: "Hello world!"
</syntaxhighlight>
 
say "Hello,": "world!"
<syntaxhighlight lang="yaml">
say("Hello"): "world!"
</syntaxhighlight>
 
say "Hello," "world!":
<syntaxhighlight lang="yaml">
say: ["Hello", "world!"]
</syntaxhighlight>
 
<syntaxhighlight lang="yaml">
# The . at the start of a value is way to indicate that the value is a scalar (string).
# Without the . this would be invalid YAML(Script).
say: ."Hello", "world!"
</syntaxhighlight>
 
Line 4,757 ⟶ 5,061:
 
=={{header|Zig}}==
 
'''Works with:''' 0.10.x, 0.11.x, 0.12.0-dev.1389+42d4d07ef
 
<syntaxhighlight lang="zig">const std = @import("std");
 
pub fn main() !void {
pub fn main() std.fs.File.WriteError!void {
try std.io.getStdOut().writer().writeAll("Hello world!\n");
const stdout = std.io.getStdOut();
 
try stdout.writeAll("Hello world!\n");
}</syntaxhighlight>
 
14

edits