Below are "hello world" examples in Pascal, BASIC, C, SharpBASIC and NASM.
Pascal:
Code: Select all
program HelloWorld(output);
begin
Write('Hello, World!')
{No ";" is required after the last statement of a block -
adding one adds a "null statement" to the program, which is ignored by the compiler.}
end.
Code: Select all
print "Hello, World!"
sleep:end rem Comment, prevents the program window from closing instantly
Code: Select all
#include <stdio.h>
int main() {
// printf() displays the string inside quotation
printf("Hello, World!");
return 0;
}
Code: Select all
incl "sys.sbi";
main do
' print to standard output device (stdout)
print("Hello, World!");
end
Code: Select all
; Define variables in the data section
SECTION .DATA
hello: db 'Hello world!',10
helloLen: equ $-hello
; Code goes in the text section
SECTION .TEXT
GLOBAL _start
_start:
mov eax,4 ; 'write' system call = 4
mov ebx,1 ; file descriptor 1 = STDOUT
mov ecx,hello ; string to write
mov edx,helloLen ; length of string to write
int 80h ; call the kernel
; Terminate program
mov eax,1 ; 'exit' system call
mov ebx,0 ; exit with error code 0
int 80h ; call the kernel