The many languages of HELLO WORLD

Jim Brown

Active Member
Licensed User
Below is a general collection of "Hello, world!" examples and how they are written in various programming languages. An interesting pattern emerges, where many employ the (){}; syntax.
However, some languages look like they were 'magicked' out of sorcery and mind-altering potions. COBOL being one of them.

Basic
B4X:
10 PRINT "Hello, world!"
B
B4X:
main() {
  printf("Hello, world!");
}
COBOL
B4X:
IDENTIFICATION DIVISION.
PROGRAM-ID.  HELLOWORLD.
PROCEDURE DIVISION.
MAIN.
  DISPLAY "Hello, world!"
  STOP RUN.
C
B4X:
#include <stdio.h>
int main(void){
  printf("Hello, world!\n");
  return 0;
}
C++
B4X:
#include <iostream>
int main(void){
  std::count << "Hello, world!\n";
  return 0;
}
C#
B4X:
using System;
class Program{
  public static void Main(string[] args){
    Console.WriteLine("Hello, world!");
  }
}
D
B4X:
module helloworld;
import std.stdio;
void main(){
  writeln("Hello, world!");
}
Dart
B4X:
main(){
  print('Hello, world!');
}
Delphi
B4X:
Program Hello_World;
{$APPTYPE CONSOLE}
Begin
  WriteLn('Hello, world!');
End.
Erlang
B4X:
io:format("~s~n", ["Hello, world!"])
Forth
B4X:
." Hello, world! "
Fortran
B4X:
program hello
  write(*,*) "Hello, world!"
end program hello
Go
B4X:
package main
func main(){
  println("Hello, world!")
}
Haskell
B4X:
main = putStrLn "Hello, world!"
Java
B4X:
class Hello{
  public static void main(String[] args){
    System.out.println("Hello, world!");
  }
}
JavaScript
B4X:
document.writeln('Hello, world!');
Lisp
B4X:
"Hello, world!"
Lua
B4X:
print("Hello, world!")
Groovy
B4X:
println "Hello, world!"
Pascal
B4X:
program HelloWorld;
begin
  WriteLn('Hello, world!');
end.
Perl
B4X:
print "Hello, world!\n";
Processing
B4X:
void setup(){
  println("Hello, world!");
}
Python
B4X:
print "Hello, world!"
Ruby
B4X:
puts 'Hello, world!'
Scala
B4X:
object HelloWorld extends App{
  println("Hello, world!")
}
Visual Basic
B4X:
Imports System
Module Module1
  Sub Main()
    Console.WriteLine("Hello, world!")
  End Sub
End Module
SQL
B4X:
SELECT "Hello, world!" AS message;
Smalltalk
B4X:
Transcript show: 'Hello, world!'
PHP
B4X:
<? echo "Hello, world!" ?>
 

sorex

Expert
Licensed User
asp

B4X:
<% response.write "Hello, world!" %>

or

<%="Hello, world!"%>
vbscript

B4X:
wscript.echo "Hello, world!" 'console
msgbox "Hello, world!" 'GUI
C64 6502 ASM (turbo assembler syntax)

B4X:
*=$0810
lda #<txt
ldy #>txt
jmp $ab1e

txt .text $e,"Hello, World!",0
 

Beja

Expert
Licensed User
Z80 pseudo code:

strL = length of "Hello World"
:beginning
Load HL, strL (define controlling counter)
Load Accumulator,( ASCII of strL)
:halfway
D3, LCD (out an ASCII byte)
Rotate A
Decrement HL and jump if not equal to zero (beginning)
Jump to halfway
LOOP

(not very accurate though)
 
Top