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