Копипаста:Hello, world!
Материал из Lurkmore
| ACHTUNG! Опасно для моска! Министерство здравоохранения Луркмора предупреждает: вдумчивое чтение нижеследующего текста способно нанести непоправимый ущерб рассудку. Вас предупреждали. |
«Hello, world!» на разных языках.
[править] BASIC
10 PRINT "Hello, World!"
[править] PureBasic
If OpenWindow(0, 100, 100, 350, 350, "hello world", #PB_Window_MaximizeGadget)
Repeat
Event=WaitWindowEvent()
Until Event=#PB_Event_CloseWindow ;Вообще надо так, но для примера можно было-бы и забить
EndIf
End-Выебосы
Или так
MessageRequester("Hello", "Hello, world!")Алсо,
OpenConsole()
Print("Hello, world!")
Input()
CloseConsole()Else (Moar выебосов):
OpenWindow(0,0,0,500,150,"hi world, lol", #PB_Window_MaximizeGadget) : TextGadget(0,0,0,100,20,"Hello, World!") : ButtonGadget(1,0,30,500,100,"PRESS THE RED SWITCH!!!!!!!!!!!111111111 (ТАК МОЙ БРАТ УМЕР!!!!111)") : Repeat : If EventGadget() = 1 : MessageRequester("Hello","Hello, World") : EndIf : Until WaitWindowEvent()=#PB_Event_CloseWindow : End[править] Fortran 77
На культовом:
PROGRAM HELLOW
WRITE(UNIT=*, FMT=*) 'Hello World'
END[править] Quick/Turbo BASIC
Или даже вот так:
? "Hello, World!"
[править] Ruby
Почти не отличается:
puts 'Hello, World!'
[править] Python
Похожим образом:
print "Hello, World!"
…или так:
import __hello__
А вот в Python 3.0 (aka Py3k, Пузик) — немного по-другому:
print("Hello, World!")[править] MS-DOS shell
echo Hello, world!
[править] Rexx
Say 'Hello, world!'
[править] Pascal
begin
Writeln('Hello, World!')
end.[править] Ада
with Ada.Text_IO;
procedure Hello_World is
begin
Ada.Text_IO.Put_Line ("Hello World");
end Hello_World;[править] Модула-3
MODULE Main;
IMPORT IO;
BEGIN
IO.Put ("Hello World\n")
END Main.[править] Visual Basic
Sub Main() print "Hello, World!" End Sub
[править] Lotus Script
Messagebox "Hello, World!", MB_OK
Или так (не самый заметный вариант):
Print "Hello, World!"
Или рядом с LS:
@Prompt([OK];"";"Hello, World!");
[править] InstallScript
Messagebox("Hello, World!", MB_OK);[править] AutoIT
MsgBox(0, "AutoIT Window", "Hello, world!", 0.75)
[править] C
На самом деле, тут следует заюзать куда более быстрый puts, нежели printf, но для примера можно и забить:
#include <stdio.h>
int main()
{
printf("Hello, World!\n");
return 0;
}[править] Objective-C для Яблочников
#import <Foundation/Foundation.h>
- (void)main{
NSLog(@"Hello, World!");
return;
}[править] C++
#include <iostream>
int main()
{
std::cout << "Hello, World!" << std::endl;
}[править] С++ ООП
#include <iostream>
class World
{
public:
static int Hello()
{
std::cout << "Hello, world!" << std::endl;
return 0;
}
};
int main()
{
return World::Hello();
}С шаблонами:
class World{};
template <typename T>
void Hello(T hello)
{
std::cout << "Hello, " << hello << std::endl;
}
template <class World>
void Hello()
{
std::cout << "Hello, world!" << std::endl;
}
int main()
{
Hello<World>();
}Чудеса КЗ грамматики:
template <typename T>
class Hello
{
public:
Hello(T hello)
{
std::cout << "Hello, " << hello << std::endl;
}
};
template <>
class Hello<class World>
{
public:
Hello()
{
std::cout << "Hello, world!" << std::endl;
}
};
int main()
{
Hello<World>();
}[править] C#
class Program
{
static void Main()
{
System.Console.WriteLine("Hello, World!");
}
}или так
class Program
{
static void Main()
{
System.Windows.Forms.MessageBox.Show("Hello, World!");
}
}[править] F#
printfn "Hello, World!"
[править] Perl
#!/usr/bin/perl print "Hello, World!\n";
или так:
perl -le 'print "Hello, World!"'
[править] Haskell
Так — в весьма простом и довольно красивом, но малопопулярном языке Haskell (обратите внимание на прекрасную читаемость и простоту кода):
import qualified Data.ByteString as BS
import System.IO
message :: [[Char]]
message = [ 'H':'e':'l':'l':'o':',':[]
, 'w':'o':'r':'l':'d':'!':[] ]
putHelloWorld :: [Char] -> IO()
putHelloWorld (x:xs) =
Prelude.putChar(x) >> putHelloWorld xs
putHelloWorld [] = Prelude.putChar('\n')
main :: IO ()
main =
hSetBuffering stdout NoBuffering >> hSetBuffering stdin LineBuffering >> putHelloWorld(message')
where
message' = let f = (++) . (++ " ")
f' = foldl1 f
in f' messageЧуть менее полный матана вариант кода на Haskell:
main = putStrLn "Hello, world!"
[править] LISP
Вообще-то будет так:
(eval (cons (quote mapcar)
(cons (cons (quote function)
(cons (quote princ) ()))
(cons (cons (quote quote)
(cons (cons #\H (cons #\e (cons #\l (cons #\l (cons #\o
(cons #\, (cons #\Space
(cons #\w (cons #\o (cons #\r (cons #\l (cons #\d (cons #\!
()))))))))))))) ())) ()))))Но можно и так:
(mapcar #'princ '(#\H #\e #\l #\l #\o #\, #\Space #\w #\o #\r #\l #\d #\!))
Или так:
(princ "Hello, world!")
Или даже так (в REPL):
"Hello, world!"
[править] BrainFuck
Нечитаемый вариант:
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.
[править] Forth
: HELLO 72 EMIT 101 EMIT 2 0 DO 108 EMIT LOOP 111 EMIT ; : WORLD 119 EMIT 111 EMIT 114 EMIT 108 EMIT 100 EMIT ; : HELLO_WORLD HELLO 44 EMIT SPACE WORLD 33 EMIT ; HELLO_WORLD
Тот же Forth без выебоновЪ:
: HelloWorld ." Hello, world!" ;
[править] Factor
USE: io IN: hello-world : hello ( -- ) "Hello, world!" print ; MAIN: hello
[править] 1С:Предприятие 7.7/8
Так решается эта задача во встроеном языке отечественного производителя 1С:
Предупреждение("Hello, world");Или так:
Сообщить("Привет, Мир!");А на 8.2 еще и так можно:
Сообщение = Новый СообщениеПользователю; Сообщение.Текст = "Хелло, Ворлд"; Сообщение.Сообщить();
[править] Java
Кофеиновый код:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}Та же жаба, с выебонами, зависящая от старого багованного верификатора кода.
public class HelloWorld {
static
{
System.out.println("Hello, world!");
System.exit(0);
}
}[править] Scala
object HelloWorld {
def main(args: Array[String]) {
println("Hello world");
}
}[править] ActionScript 2.0
traсe ("hello world!");[править] ActionScript 3.0
traсe ("hello world!");Или так:
var field:TextField=new TextField(); field.text="hello world!"; addChild(field);
[править] Eiffel
class HELLO_WORLD
feature
print_hello is
-- Print "Hello, World!"
do
print ("Hello, World!")
end
end[править] MIDlet Pascal
Program Hello;
Begin
DrawText('Hello, world!', 5, 5);
Repaint; Delay(5000);
End.[править] PHP
echo "Hello, world!";
Или так (при вставке кода в HTML):
<?="Hello, world!"?>
Или с использованием ОО-паттернов программирования:
/********************************************************************
Model-View-Controller implementation according to POSA
(Pattern-Oriented Software Architecture
http://www.hillside.net/patterns/books/Siemens/book.html)
********************************************************************/
class HelloWorldController {
private $model;
function __construct($model) {
$this->model = $model;
}
function handleEvent($args) {
$this->model->setStrategy($args[2]);
$this->model->addText($args[1]);
}
}
class HelloWorldModel {
private $text;
private $observers = array();
private $strategy;
function attach($observer) {
$this->observers[] = $observer;
}
function getData() {
$facade = new HelloWorldFacade($this->strategy);
return $facade->getHelloWorld().$this->text."\n";
}
function addText($text='') {
$this->text = $text;
$this->notify();
}
function setStrategy($strategy) {
$this->strategy = $strategy;
}
function notify() {
foreach ($this->observers as $observer) {
$observer->update();
}
}
}
class HelloWorldView {
private $model;
function initialize($model) {
$this->model = $model;
$model->attach($this);
return $this->makeController();
}
function makeController() {
return new HelloWorldController($this->model);
}
function update() {
$this->display();
}
function display() {
echo $this->model->getData();
}
}
/*********************************************************************
"Business logic"
********************************************************************/
class HelloWorld {
function execute() {
return "Hello world";
}
}
class HelloWorldDecorator {
private $helloworld;
function __construct($helloworld) {
$this->helloworld = $helloworld;
}
function execute() {
return $this->helloworld->execute();
}
}
abstract class HelloWorldEmphasisStrategy {
abstract function emphasize($string);
}
class HelloWorldBangEmphasisStrategy extends HelloWorldEmphasisStrategy {
function emphasize($string) {
return $string."!";
}
}
class HelloWorldRepetitionEmphasisStrategy extends HelloWorldEmphasisStrategy {
function emphasize($string) {
return $string." and ".$string." again";
}
}
class HelloWorldEmphasizer extends HelloWorldDecorator {
private $strategy;
function HelloWorldEmphasizer($helloworld,$strategy) {
$this->strategy = $strategy;
parent::__construct($helloworld);
}
function execute() {
$string = parent::execute();
return $this->strategy->emphasize($string);
}
}
class HelloWorldStrategyFactory {
static function make($type) {
if ($type == 'repetition') return self::makeRepetitionStrategy();
return self::makeBangStrategy();
}
static function makeBangStrategy() {
return new HelloWorldBangEmphasisStrategy;
}
static function makeRepetitionStrategy() {
return new HelloWorldRepetitionEmphasisStrategy;
}
}
class HelloWorldFormatter extends HelloWorldDecorator {
function execute() {
$string = parent::execute();
return $string."\n";
}
}
class HelloWorldFacade {
private $strategy;
function __construct($strategyType) {
$this->strategy = HelloWorldStrategyFactory::make($strategyType);
}
function getHelloWorld() {
$formatter = new HelloWorldFormatter(
new HelloWorldEmphasizer(
new HelloWorld,$this->strategy));
return $formatter->execute();
}
}
$model = new HelloWorldModel;
$view = new HelloWorldView;
$controller = $view->initialize($model);
$controller->handleEvent($_SERVER['argv']);[править] Vbscript
Msgbox "Hello world!"
[править] Javascript
$=~[];$={___:++$,$$$$:(![]+"")[$],__$:++$,$_$_:(![]+"")[$],_$_:++$,$_$$:({}+"")[$],$$_$:($[$]+"")[$],_$$:++$,$$$_:(!""+"")[$],$__:++$,$_$:++$,$$__:({}+"")[$],$$_:++$,$$$:++$,$___:++$,$__$:++$};$.$_=($.$_=$+"")[$.$_$]+($._$=$.$_[$.__$])+($.$$=($.$+"")[$.__$])+((!$)+"")[$._$$]+($.__=$.$_[$.$$_])+($.$=(!""+"")[$.__$])+($._=(!""+"")[$._$_])+$.$_[$.$_$]+$.__+$._$+$.$;$.$$=$.$+(!""+"")[$._$$]+$.__+$._+$.$+$.$$;$.$=($.___)[$.$_][$.$_];$.$($.$($.$$+"\""+$.$$_$+$._$+$.$$__+$._+"\\"+$.__$+$.$_$+$.$_$+$.$$$_+"\\"+$.__$+$.$_$+$.$$_+$.__+".\\"+$.__$+$.$$_+$.$$$+"\\"+$.__$+$.$$_+$._$_+"\\"+$.__$+$.$_$+$.__$+$.__+$.$$$_+"(\\\"\\"+$.__$+$.__$+$.___+$.$$$_+(![]+"")[$._$_]+(![]+"")[$._$_]+$._$+", \\"+$.__$+$.$$_+$.$$$+$._$+"\\"+$.__$+$.$$_+$._$_+(![]+"")[$._$_]+$.$$_$+"!\\\")\\"+$.$$$+$._$$+"\"")())();Или вот так (не работает, когда броузер парсит страницу как XHTML, то есть в далеком будущем, когда сервера начнут отдавать страницы с MIME-типом application/xhtml+xml)
document.write("Hello, world!");Или вот так (окно с сообщением)
alert("Hello, world!");Или вот так на Action script 3.0 (флэшовая реализация стандарта ECMAScript):
trace('Hello World!');
//Или, если непременно надо вывести прямо на экран, а не в консоль, так:
var tf:TextField = new TextField;
tf.text = "Hello World!";
addChild(tf);Или если ООП:
package {
import flash.display.Sprite;
public class HelloWorld extends Sprite {
public function HelloWorld() {
trace ("Hello, world!");
}
}
}Теперь оно и сервер-сайд!
#!/usr/bin/env node
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');[править] Delphi
В консоли:
{$APPTYPE CONSOLE}
begin
Writeln('Hello, world!');
end.Или сообщением:
begin MessageBox(0,'Hello, world!','my 1st program',0); end.
Или более подходящим сообщением:
begin
ShowMessage('Hello, world!');
end.Или с помощью формы (Label1 должно быть на ней):
begin Label1.Caption := 'Hello World!'; end;
Или с помощью визуального проектирования:
[править] sh
echo Hello, world!
Или так
cat <<EOF Hello world! EOF
Индусский вариант
for i in 'H' 'e' 'l' 'l' 'o' ' ' 'w' 'o' 'r' 'l' 'd' '!' '\n'; do
echo -ne "$i"
done[править] На bash.orge
http://bash.org.ru/?text=Hello+world
[править] На Прологе
goal :-
write ("Hello, World!").[править] SQL запрос
[править] SQL-92
select 'Hello, World!'
[править] Oracle SQL
select 'Hello, World!' from dual;
[править] Oracle PL/SQL
SET serveroutput ON
BEGIN
dbms_output.put_line('Hello world!');
END;
/[править] Microsoft SQL Server
PRINT 'Hello, world';
[править] MySQL
select 'Hello, World!';
[править] FireBird SQL / InterBase
select 'Hello, World!' FROM RDB$DATABASE;
[править] Informix
SELECT FIRST 1 'Hello, World!' FROM systables;
Обычно хеллоуворлдщика можно ввести в транс, добавив в какой-нибудь частоиспользуемый header-файл следующие строчки (ахтунг, C-specific!):
#ifndef DEFINE_ME #error Fatal error! There must be some brain in your head! #endif
[править] Ассемблер
Очевидно, что никакой сложности в решении такая задача собой не представляет. Тем не менее, решив подобную задачу на каком-либо языке программирования, субъект чаще всего начинает oшибочно самоидентифицироваться с программистом.
Однако на языках ассемблера данная задача представляется более сложной:
[править] Assembler i8086, MS-DOS, masm
.model tiny .code org 100h Start: mov ah, 9 mov dx, offset msg int 21h mov ax, 4C00H int 21h msg db 'Hello, world$' end Start
[править] Assembler i8086, MS-DOS, tasm
mov ax, 0b800h mov ds, ax mov [02h], 'H' mov [04h], 'e' mov [06h], 'l' mov [08h], 'l' mov [0ah], 'o' mov [0ch], ',' mov [0eh], 'W' mov [10h], 'o' mov [12h], 'r' mov [14h], 'l' mov [16h], 'd' mov [18h], '!' ret
[править] Assembler i386, Linux, nasm
SECTION .data msg: db "Hello, world",10 len: equ $-msg SECTION .text global main main: mov edx, len mov ecx, msg mov ebx, 1 mov eax, 4 int 0x80 mov ebx, 0 mov eax, 1 int 0x80
[править] То же, только GAS
.data msg: .ascii "Hello,world!\n" len = . - msg .text .globl _start _start: movl $4,%eax movl $1,%ebx movl $msg,%ecx movl $len,%edx int $0x80 xorl %ebx,%ebx movl $1,%eax int $0x80
[править] Assembler i386, Windows, masm
.386 .model flat, stdcall option casemap:none include \masm32\include\windows.inc include \masm32\include\kernel32.inc includelib \masm32\lib\kernel32.lib .data msg db "Hello, world!", 13, 10 len equ $-msg .data? written dd ? .code start: push -11 call GetStdHandle push 0 push offset written push len push offset msg push eax call WriteFile push 0 call ExitProcess end start
Или так:
.386 .model flat, STDCALL includelib kernel32.lib GetStdHandle PROTO:DWORD WriteConsoleA PROTO:DWORD,:DWORD,:DWORD,:DWORD,:DWORD ExitProcess PROTO:DWORD .const message db "Hello, world!" .code Main PROC LOCAL hStdOut :DWORD push -11 call GetStdHandle mov hStdOut,EAX push 0 push 0 push 16d push offset message push hStdOut call WriteConsoleA push 0 call ExitProcess Main ENDP End Main
[править] Assembler микроконтроллер ATMega16, AVR Studio
.include "m16def.inc" .cseg .org $0000 rjmp start ;Reset handler .org $0030 start: ldi r24, 25 ; ~= 9600 @ 4Mhz clock out UBRRL, r24 out UBRRH, r2 ldi r24, 1 << TXEN out UCSRB, r24 ldi r24, 1 << URSEL | 1 << UCSZ0 | 1 << UCSZ1 ; 8-n-1 out UCSRC, r24 ; send msg ldi ZL, msg << 1 loop: lpm r0, Z+ ; next char tst r0 ; terminated? stop: breq stop while_busy: sbis UCSRA, UDRE rjmp while_busy out UDR, r0 rjmp loop msg: .db "Hello, world!", 13, 10, 0
[править] На двух семисегментных индикаторах и VHDL
LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; USE IEEE.NUMERIC_STD.ALL; USE IEEE.STD_LOGIC_UNSIGNED.ALL; ENTITY CTL IS PORT( CLK: IN STD_LOGIC; DOUT1: OUT STD_LOGIC_VECTOR(0 TO 6); DOUT2: OUT STD_LOGIC_VECTOR(0 TO 6) ); END ENTITY; ARCHITECTURE CTL_ARCH OF CTL IS SIGNAL CNT: STD_LOGIC_VECTOR(0 TO 3):="0000"; BEGIN PROCESS(CLK) BEGIN IF (CLK'EVENT AND CLK='1') THEN IF CNT = "1011" THEN CNT <= "0000"; END IF; CASE CNT IS WHEN "0000" => DOUT1 <= "1001000"; DOUT2 <="1111111";--H WHEN "0001" => DOUT1 <= "0110001"; DOUT2 <="1111111";--E WHEN "0010" => DOUT1 <= "1110001"; DOUT2 <="1111111";--L WHEN "0011" => DOUT1 <= "1110001"; DOUT2 <="1111111";--L WHEN "0100" => DOUT1 <= "0000001"; DOUT2 <="1111111";--O WHEN "0101" => DOUT1 <= "1111111"; DOUT2 <="1111111";-- WHEN "0110" => DOUT1 <= "1100001"; DOUT2 <="1000001"; --W(1) W(2) WHEN "0111" => DOUT1 <= "0000001"; DOUT2 <="1111111";--O WHEN "1000" => DOUT1 <= "0011000"; DOUT2 <="1111111";--R WHEN "1001" => DOUT1 <= "1110001"; DOUT2 <="1111111";--L WHEN "1010" => DOUT1 <= "0000001"; DOUT2 <="1111111";--D WHEN OTHERS => DOUT1 <= "1111111"; DOUT2 <="1111111"; END CASE; CNT<= CNT+1; END IF; END PROCESS; END CTL_ARCH;
[править] HQ9+ / HQ9++ / HQ9+/-
H
[править] C++ с использованием Component Object Model
[ uuid(2573F8F4-CFEE-101A-9A9F-00AA00342820) ] library LHello { importlib("actimp.tlb"); importlib("actexp.tlb"); #include "pshlo.idl" [ uuid(2573F8F5-CFEE-101A-9A9F-00AA00342820) ] cotype THello { interface IHello; interface IPersistFile; }; }; [ exe, uuid(2573F890-CFEE-101A-9A9F-00AA00342820) ] module CHelloLib { importheader(); importheader(); importheader(); importheader("pshlo.h"); importheader("shlo.hxx"); importheader("mycls.hxx"); importlib("actimp.tlb"); importlib("actexp.tlb"); importlib("thlo.tlb"); [ uuid(2573F891-CFEE-101A-9A9F-00AA00342820), aggregatable ] coclass CHello { cotype THello; }; };
#include "ipfix.hxx" extern HANDLE hEvent; class CHello : public CHelloBase { public: IPFIX(CLSID_CHello); CHello(IUnknown *pUnk); ~CHello(); HRESULT __stdcall PrintSz(LPWSTR pwszString); private: static int cObjRef; }; #include "thlo.h" #include "pshlo.h" #include "shlo.hxx" #include "mycls.hxx" int CHello:cObjRef = 0; CHello::CHello(IUnknown *pUnk) : CHelloBase(pUnk) { cObjRef++; return; } HRESULT __stdcall CHello::PrintSz(LPWSTR pwszString) { printf("%ws\n", pwszString); return(ResultFromScode(S_OK)); } CHello::~CHello(void) { cObjRef--; if( cObjRef == 0 ) PulseEvent(hEvent); return; } #include "pshlo.h" #include "shlo.hxx" #include "mycls.hxx" HANDLE hEvent; int _cdecl main(int argc, char * argv[]) { ULONG ulRef; DWORD dwRegistration; CHelloCF *pCF = new CHelloCF(); hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); CoInitiali, NULL); CoInitializeEx(NULL, COINIT_MULTITHREADED); CoRegisterClassObject(CLSID_CHello, pCF, CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &dwRegistration); WaitForSingleObject(hEvent, INFINITE); CoRevokeClassObject(dwRegistration); ulRef = pCF->Release(); CoUninitialize(); return(0); } extern CLSID CLSID_CHello; extern UUID LIBID_CHelloLib; CLSID CLSID_CHello = { 0x2573F891, 0xCFEE, 0x101A, { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 } }; UUID LIBID_CHelloLib = { 0x2573F890, 0xCFEE, 0x101A, { 0x9A, 0x9F, 0x00, 0xAA, 0x00, 0x34, 0x28, 0x20 } }; #include "pshlo.h" #include "shlo.hxx" #include "clsid.h" int _cdecl main( int argc, char * argv[]) { HRESULT hRslt; IHello *pHello; ULONG ulCnt; IMoniker * pmk; WCHAR wcsT[_MAX_PATH]; WCHAR wcsPath[2 * _MAX_PATH]; wcsPath[0] = '\0'; wcsT[0] = '\0'; if( argc 1) { mbstowcs(wcsPath, argv[1], strlen(argv[1]) + 1); wcsupr(wcsPath); } else { fprintf(stderr, "Object path must be specified\n"); return(1); } if(argc 2) mbstowcs(wcsT, argv[2], strlen(argv[2]) + 1); else wcscpy(wcsT, L"Hello World"); printf("Linking to object %ws\n", wcsPath); printf("Text String %ws\n", wcsT); hRslt = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(SUCCEEDED(hRslt)) { hRslt = CreateFileMoniker(wcsPath, &pmk); if(SUCCEEDED(hRslt)) hRslt = BindMoniker(pmk, 0, IID_IHello, (void **)&pHello); if(SUCCEEDED(hRslt)) { pHello->PrintSz(wcsT); Sleep(2000); ulCnt = pHello->Release(); } else printf("Failure to connect, status: %lx", hRslt); CoUninitialize(); } return(0); }
[править] MSIL
.assembly HelloWorld
{
}
.method static void Main()
{
.entrypoint
ldstr "Hello World!"
call void [mscorlib]System.Console::WriteLine(string)
ret
}[править] GML
На GML:
show_message("Hello, World!");или же
draw_text(42, 42, "Hello, World!");
[править] Blitz3D, язык для новичков
Способ 1:
Text 0,0,"Hello, world!"
Способ 2:
Print "Hello, world!" WaitKey ;Или Delay 5000
Способ 3, с выебонами:
Const HWtxt$ = "Hello, world!" Graphics 800,600,32,2 SetBuffer BackBuffer() Type TCharacter Field c$ End Type GenerateHelloWorld While Not KeyDown(1) Cls DrawHelloWorld Flip Wend End Function GenerateHelloWorld() For i = 1 To Len(HWtxt) Local char.TCharacter = New TCharacter char\c = Mid(HWtxt,i,1) Next End Function Function DrawHelloWorld() For char.TCharacter = Each TCharacter i = i + 1 Text i*10,10,char\c Next End Function
[править] Универсальный вариант
Универсальный Hello World! на C, C++, Haskell, Ruby, Python, Perl(x2), HTML, tcl, zsh, make, bash и brainfuck
# /* [ <!-- */ include <stdio.h> /* \
#{\
`""""true \\#{"\n#"}; \
\
if [ -n "$ZSH_VERSION" ]; then \
\
echo exec echo I\'m a zsh script.; \
\
elif [ -n "$BASH_VERSION" ]; then \
\
echo exec echo I\'m a bash script.; \
else \
echo exec echo I\'m a sh script.; \
fi`; #\
BEGIN{print"I'm a ", 0 ? "Ruby" :"Perl", " program.\n"; exit; }
#\
%q~
set dummy =0; puts [list "I'm" "a" "tcl" "script."]; exit
all: ; @echo "I'm a Makefile." \
#*/
/*: */ enum {a, b}; \
\
static int c99(void) {
#ifndef __cplusplus /* bah */
unused1: if ((enum {b, a})0) \
(void)0;
#endif
unused2: return a; \
} \
static int trigraphs(void) { \
\
return sizeof "??!" == 2; \
} \
char X; \
\
int main(void) { \
\
struct X { \
\
char a[2]; \
};\
if (sizeof(X) != 1) { \
\
printf("I'm a C++ program (trigraphs %sabled).\n", \
\
trigraphs() ? "en" : "dis");\
\
}else if (1//**/2
)unused3 : { ; \
printf("I'm a C program (C%s, trigraphs %sabled).\n", \
c99() ? "89 with // comments" : "99", \
trigraphs() ? "en" : "dis"); \
} else { \
printf("I'm a C program (C89, trigraphs %sabled).\n", \
trigraphs() ? "en" : "dis"); \
} \
return 0; \
} /*
# \
> main :: IO () -- -- \
> main = putStr "I'm a Literate Haskell program.\n"
# \
]>++++++++[<+++++++++>-]<+.>>++++[<++++++++++>-]<-.[-]>++++++++++ \
[<+++++++++++>-]<-.>>++++[<++++++++>-]<.>>++++++++++[<++++++++++> \
-]<- - -.<.>+.->>++++++++++[<+++++++++++>-]<++++.<.>>>++++++++++[ \
<++++++++++>-]<+++++.<<<<+.->>>>- - -.<+++.- - -<++.- ->>>>>+++++ \
+++++[<+++++++++++>-]<- - -.<<<<<.<+++.>>>.<<<-.- ->>>>+.<.<.<<.> \
++++++++++++++.[-]++++++++++"""`
# \
print "I'm a Python program."; """[-][--><html><head>
<!--:--><title>I'm a HTML page</title></head><body>
<!--:--><h1>I'm a <marquee><blink>horrible HTML</blink></marquee> page</h1>
<!--:--><script language="Javascript">
<!--: # \
setTimeout( // \
function () { // \
document.body.innerHTML = "<h1>I'm a javascript-generated HTML page</h1>"; // \
}, 10000); // \
//-->
</script><!--: \
</body></html><!-- } # \
say "I'm a Perl6 program", try { " ($?PUGS_VERSION)" } // "", "."; # """ # */
#define FOO ]-->~[править] NATURAL
define data local 1 #BUTTON(A1) end-define Write notitle 'Hello, world!' display notitle 'Hello, world!' print 'Hello, world!' PROCESS GUI ACTION MESSAGE-BOX WITH NULL-HANDLE 'Hello, world!' ' ' 'IO1' #BUTTON GIVING *ERROR-nr Input (ad=od) 'Hello, world!' end
[править] LSL
default
{
state_entry()
{
llSay(0,"Hello, world!");
}
}[править] Erlang
#!/usr/bin/env escript
main(_Args) ->
io:format("Hello, World!~n").[править] Malbolge
(=<`:9876Z4321UT.-Q+*)M'&%$H"!~}|Bzy?=|{z]KwZY44Eq0/{mlk**hKs_dG5[m_BA{?-Y;;Vb'rR5431M}/.zHGwEDCBA@98\6543W10/.R,+O<[править] LOLCODE
HAI CAN HAS STDIO? VISIBLE "HAI WORLD!" KTHXBYE
[править] Go
package main
import "fmt"
func main() {
fmt.Println("Hello, world!")
}[править] ProceRaptor
application ($console,$void);
var ("st",$string);
"Hello World!">>st;
write (st,$line);
read ($void,$line);
exit();[править] Icon
procedure main()
write("Hello, world!")
end