Hello world/Line printer: Difference between revisions

m
(→‎Joy: add)
m (→‎{{header|Wren}}: Minor tidy)
 
(4 intermediate revisions by 4 users not shown)
Line 128:
 
=={{header|BASIC}}==
{{works with|GW-BASIC}}
{{works with|QBasic}}
{{works with|MSX BASIC}}
{{works with|ZX Spectrum Basic}}
{{works with|Liberty BASIC}}
Line 155 ⟶ 157:
PRINT #prn%, "Hello World!"
CLOSE #prn%</syntaxhighlight>
 
==={{header|GW-BASIC}}===
{{works with|BASICA}}
{{works with|PC-BASIC}}
{{works with|QBasic}}
<syntaxhighlight lang="qbasic">LPRINT "Hello World!"</syntaxhighlight>
 
==={{header|IS-BASIC}}===
<syntaxhighlight lang="is-basic">LPRINT "Hello World!"</syntaxhighlight>
 
==={{header|MSX Basic}}===
<syntaxhighlight lang="qbasic">LPRINT "Hello World!"</syntaxhighlight>
 
==={{header|True BASIC}}===
<syntaxhighlight lang="qbasic">OPEN #1: PRINTER !Open channel #1 for the printer
PRINT #1: "Hello World!"
END</syntaxhighlight>
 
==={{header|Yabasic}}===
Line 425 ⟶ 441:
EZPF</syntaxhighlight>
 
==={{header| Alternative}} ===
As noted, null in the sense of zero cannot be used as a string terminator on EDSAC. However, it is possible to use the EDSAC null, whose 5-bit code is 10000. The subroutine below demonstrates this.
 
Line 764 ⟶ 780:
Assuming that the line printer is attached to /dev/lp0:
<syntaxhighlight lang="nim">var lp = open("/dev/lp0", fmWrite)
lp.writelnwriteLine "Hello World"
lp.close()</syntaxhighlight>
 
Line 964 ⟶ 980:
O 11 'Hello world'
</syntaxhighlight>
 
=={{header|RPL}}==
"Hello world!" PR1
 
=={{header|Ruby}}==
Line 1,145 ⟶ 1,164:
=={{header|Wren}}==
It is not currently possible to communicate with the printer using Wren-cli. So we need to write a minimal embedded program (no error checking) so the C host can do this for us.
<syntaxhighlight lang="ecmascriptwren">/* hello_world_line_printerHello_world_Line_printer.wren */
 
class C {
Line 1,154 ⟶ 1,173:
<br>
We now embed this in the following C program, compile and run it.
<syntaxhighlight lang="c">/* gcc hello_world_line_printerHello_world_Line_printer.c -o hello_world_line_printerHello_world_Line_printer -lwren -lm */
 
#include <stdio.h>
Line 1,209 ⟶ 1,228:
WrenVM* vm = wrenNewVM(&config);
const char* module = "main";
const char* fileName = "hello_world_line_printerHello_world_Line_printer.wren";
char *script = readFile(fileName);
WrenInterpretResult result = wrenInterpret(vm, module, script);
9,477

edits