I was advised that my first blog post should be a simple introduction, so the best way to do that would be in various languages I have learned over the years. So here goes…
BASIC
10 print “Hello, world!”
C
void main( void ) {
printf( “Hello, world!” );
}
Pascal
program Hello;
begin
writeln ( 'Hello, world.' )
end.
x86 Assembler
org 0x100
mov dx, msg
mov ah, 0x09
int 0x21 ; DOS Interrupt: ah = 0x09 - Print string function
mov ah, 0x4c
int 0x21 ; DOS Interrupt: ah = 0x4c - Terminate function
msg db 'Hello, World!', 0x0d, 0x0a, '$' ; $-terminated message
COBOL
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO-WORLD.
* simple hello world program
PROCEDURE DIVISION.
DISPLAY 'Hello world!'.
STOP RUN.
Lisp
( DEFUN HELLO ( ) “Hello, world!” )
Bash
#!/bin/bash
GREETING = "Hello World!"
echo $GREETING
C++
#include<iostream>
using namespace std;
class Greeting {
public:
void display( ) {
cout << "Hello World\n";
}
};
int main( void ) {
Greeting g;
g.display( );
return 0;
}
HTML
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
<HEAD>
<TITLE>
Hello, world!
</TITLE>
</HEAD>
<BODY>
Hello, world!
</BODY>
</HTML>
Perl
#!/usr/bin/perl
use strict;
use warnings;
print( "Hello, World!" );
Java
public class HelloWorld {
public static void main( String[] args ) {
System.out.println( "Hello, World" );
}
}
AccentR
$ ACCENT
* type “Hello, World!”
SQL
select “Hello, world!”;
Objective-C
#import <Foundation/Foundation.h>
@interface HelloWorldClass:NSObject
- ( void ) displayMessage;
@end
@implementation HelloWorldClass
(void) displayMessage {
NSLog( @"Hello, World! \n” );
}
@end
int main( ) {
HelloWorldClass *helloWorldClass = [ [ HelloWorldClass alloc ] init ];
[ helloWorldClass displayMessage ];
return 0;
}
Arduino
void setup( ) {
pinMode( LED_BUILTIN, OUTPUT );
}
void loop( ) {
digitalWrite( LED_BUILTIN, HIGH );
delay( 1000 );
digitalWrite( LED_BUILTIN, LOW );
delay( 1000 );
}
Python
def displayMessage( ):
print( “Hello, world!” )
displayMessage( )
Swift
let greeting: String = “Hello, world!”
print( “\( greeting )” )
SwiftUI
import SwiftUI
@main
struct HelloWorldApp: App {
var body: some Scene {
WindowGroup {
Text("Hello, world!")
}
}
}
