Hello world/Console

Wikibooks, manuali e libri di testo liberi.
Jump to navigation Jump to search

Di seguito sono illustrati esempi di Hello world eseguiti in terminali testuali

ABAP[modifica]

   write 'hello, world'. 


Ada[modifica]

with Ada.Text_IO;
 
procedure Hello is
 begin
   Ada.Text_IO.Put_Line ("hello, world");
end Hello;

ALGOL[modifica]

   'BEGIN'
       OUTSTRING(2,'('HELLO, WORLD')');
   'END'

APL[modifica]

   'Hello, World!'

ASP 3.0[modifica]

<%
    Response.Write("Hello, World!")
%>

Versione breve:

    <%= "Hello, World!" %>

Assembly (x86 CPU, DOS, TASM syntax)[modifica]

   IDEAL
   MODEL SMALL
   STACK 100h
   DATASEG
       HW      DB      "hello, world", 13, 10, '$'
   CODESEG
   Begin:
       MOV AX, @data
       MOV DS, AX
       MOV DX, OFFSET HW
       MOV AH, 09H
       INT 21H
       MOV AX, 4C00H
       INT 21H
   END Begin

awk[modifica]

   BEGIN { print "hello, world" }

Bash[modifica]

#!/bin/bash
echo "hello, world"

BASIC[modifica]

BASIC tradizionale (non strutturato):

10 PRINT "hello, world!"
20 END

BASIC moderno (strutturato):

print "hello, world"

BasicAlgorytm[modifica]

   %write "hello, world"

BCPL[modifica]

   GET "LIBHDR"
    
   LET START () BE
   $(
       WRITES ("hello, world*N")
   $)


BeanShell[modifica]

   print("hello, world");

Bourne shell[modifica]

   echo 'hello, world'

Brainfuck[modifica]

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

C[modifica]

#include <stdio.h>

int main()
{
    printf("Hello, World!");
    return 0;
}

C++[modifica]

#include <iostream>

int main(){
    std::cout << "hello, world"<< std::endl;
    return 0;
}




________________________________________

#include <stdio.h>
 
int main()
{
    printf("Hello, World!");
    return 0;
}

C++/CLI[modifica]

int main()
{
  System::Console::WriteLine("hello, world");
}

C#[modifica]

class HelloWorldApp
{
  public static void Main()
  {
    System.Console.WriteLine("hello, world");
  }
}

COBOL[modifica]

   IDENTIFICATION DIVISION.
   PROGRAM-ID.     HELLO-WORLD.
    
   ENVIRONMENT DIVISION.
    
   DATA DIVISION.
    
   PROCEDURE DIVISION.
   DISPLAY 'hello, world'. 

ColdFusion[modifica]

<cfset myString="Hello, World!">
<cfoutput>#myString#</cfoutput>

versione rapida

<cfoutput>Hello, World!</cfoutput>

versione CFScript

<cfscript>
    myString="Hello, World!";
    WriteOutput(myString);
</cfscript>

versione CFScript rapida

<cfscript>
    WriteOutput("Hello, World!");
</cfscript>

Common LISP[modifica]

(print "Hello, World!")

D[modifica]

import std.stdio;
void main(){
   writefln("Hello, World!");
}

Delphi[modifica]

program HelloWorld;
{$APPTYPE CONSOLE}
begin
  WriteLn('hello, world');
end.

EASY[modifica]

   module helloworld
   procedure Main
     cgiclosebuffer
     cgiwriteln("content-type: text/html")
     cgiwriteln("")
     cgiwriteln("hello, world")
   endproc

Eiffel[modifica]

    class HELLO_WORLD
    &nbsp;
    creation
        make
    feature
        make is
        do
                io.put_string("hello, world%N")
        end -- make
    end -- class HELLO_WORLD

Emacs Lisp[modifica]

(print "Hello World")

Erlang[modifica]

   -module(Hello).
   -export([Hello_World/0]).
    
   Hello_World() -> io:fwrite("hello, world\n").

F#[modifica]

printfn "hello, world"

Forth[modifica]

 : Helloforth ( -- ) ." hello, world" ;

Fortran[modifica]

   PROGRAM HELLO
   WRITE(*,10)
10 FORMAT('hello, world')
   STOP
   END

Haskell[modifica]

   main = putStrLn "hello, world"


IDL[modifica]

print,'Hello World'

Io[modifica]

"Hello World" print

Iptscrae[modifica]

   ON ENTER {
       "Hello " "World!" & SAY
   }

Java[modifica]

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

JSP[modifica]

<%
    out.println("Hello, World!");
%>

Versione breve:

<%= "Hello, World!" %>

riti[modifica]

   print "hello, world"

[modifica]

   print word "hello, world"

MATLAB[modifica]

fprintf('Hello, world !')

MIRC scripting[modifica]

alias helloworld {
.echo -a hello, world
}

oppure, in forma breve, applicabile da una finestra qualunque:

/echo hello world

MIXAL[modifica]

    TERM    EQU    19          the MIX console device number
            ORIG   1000        start address
    START   OUT    MSG(TERM)   output data at address MSG
            HLT                halt execution
    MSG     ALF    "MIXAL"
            ALF    " HELL"
            ALF    "O WOR"
            ALF    "LD   "
            END    START       end of the program

MS-DOS Batch[modifica]

@echo hello, world

Natural[modifica]

   WRITE 'Hello World'
   *
   END

Oberon[modifica]

   MODULE HelloWorld;
   IMPORT Write;
   BEGIN
       Write.Line("hello, world");
   END HelloWorld.

Objective C (Con Cocoa)[modifica]

#import <Foundation/Foundation.h>

int main (int argc, const char * argv[])
{
  NSAutoreleasePool * pool = [[w:NSAutoreleasePool alloc] init];

  NSLog(@"Hello, World!");
  [pool release];

  return 0;
}

OCaml[modifica]

let main () =
   print_endline "hello, world";;

Ook![modifica]

Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. 
Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook.
Ook! Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook?
Ook! Ook! Ook? Ook! Ook? Ook. Ook. Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook. Ook! Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook.
Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook! Ook? Ook? Ook. Ook. Ook.
Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook. Ook? Ook! Ook! Ook? Ook! Ook? Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook! Ook. Ook. Ook. Ook. Ook. Ook. Ook.
Ook! Ook. Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook.
Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook! Ook!
Ook! Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook! Ook.

OPL[modifica]

   PROC Hello:
     PRINT "Hello World"
   ENDP

Pascal[modifica]

program Hello;
begin
  Writeln('Hello, World!');
end.

Perl[modifica]

#!/usr/bin/perl
print "hello, world\n";

PHP[modifica]

Codifica in PHP, inserita nel linguaggio HTML
<?php
    echo 'hello, world';
?>

Oppure:

<?php
    print("hello, world");
?>

Versione minimalista:

<?='hello, world'?>

Pike[modifica]

   int main() {
       write("hello, world\n");
       return 0;
   }

PL/I[modifica]

   Test: procedure options(main);
      declare My_String char(20) varying init('hello, world');
      put skip list(My_String);
   end Test;

PL/SQL[modifica]

BEGIN
   DBMS_OUTPUT.PUT_LINE('hello, world');
END;

Prolog[modifica]

   ?- write("hello, world"), nl.

PureBasic[modifica]

   OpenConsole()
   Print("hello, world")
   CloseConsole()

Python[modifica]

print "hello, world"

Versione breve:

"hello, world"

Versione Easter egg:

import __hello__

R[modifica]

   cat("hello, world")

REXX[modifica]

   say "hello, world"

RPL[modifica]

   << "hello, world" 1 Disp>>

Ruby[modifica]

puts "hello, world"

Versione minimalista:

p "hello, world"

Scheme[modifica]

(display "hello, world")
(newline)

sed[modifica]

Serve come minimo un Input:

   sed -ne '1s/.*/hello, world/p'

Oppure, forma breve:

   sed 's/.*/hello, world/'

Seed7[modifica]

$ include "seed7_05.s7i";

const proc: main is func
  begin
    writeln("hello, world");
  end func;

Smalltalk[modifica]

Transcript show: 'hello, world'

SML[modifica]

   print "hello, world\n";

SNOBOL4[modifica]

       OUTPUT = "hello, world"
   END

STARLET[modifica]

   RACINE: HELLO_WORLD.
    
   NOTIONS:
   HELLO_WORLD : ecrire("hello, world").

SQL[modifica]

select 'hello, world' as message;

Per Oracle-Database

select 'hello, world' from dual;

Per IBM-DB2

select 'hello, world' from sysibm.sysdummy1;

Per Microsoft SQL Server:

print 'hello, world';

oppure:

values('hello, world');

StarOffice Basic[modifica]

   sub main
   print "hello, world"
   end sub

Tcl[modifica]

puts "hello, world"

TI-BASIC[modifica]

   :Disp "hello, world"

TOM[modifica]

   int
     main Array arguments
   {
     [[w:[stdio out] print "hello, world"] nl];
   }

Turing[modifica]

   put "hello, world"

Visual Basic .Net[modifica]

Module Main
    Sub Main()
        Console.WriteLine("hello, world")
    End Sub
End Module