Hello World in Different Languages

"Hello, World!" is a simple program that outputs or displays the string "Hello, World!" to the user. It's traditionally used as the first program that new programmers learn, mainly for the following reasons:

1. Simplicity: A "Hello, World!" program is typically one of the simplest programs possible in most programming languages, which makes it a good way for beginners to see the basic syntax of a programming language without being overwhelmed by complex concepts.

2. Verification: Running a "Hello, World!" program verifies that your development environment is set up correctly. If you can successfully run such a program, you know that your compiler/interpreter, development environment, and general setup are functioning as expected.

3. Tradition: The practice has become a programming tradition after it was used in the seminal book "The C Programming Language" by Brian Kernighan and Dennis Ritchie. The tradition has been carried forward to nearly every language since then.

"Hello, World!" can be a stepping stone to more complex programs, and it's often the first example given in programming language tutorials.

Assembly:

lobal _start section .text _start: mov rax, 1 ; write( mov rdi, 1 ; STDOUT_FILENO, mov rsi, msg ; "Hello, world!\n", mov rdx, msglen ; sizeof("Hello, world!\n") syscall ; ); mov rax, 60 ; exit( mov rdi, 0 ; EXIT_SUCCESS syscall ; ); section .rodata msg: db "Hello, world!", 10 msglen: equ $ - msg

Cobol

IDENTIFICATION DIVISION. PROGRAM-ID. HELLOWRD. PROCEDURE DIVISION. DISPLAY "HELLO WORLD". STOP RUN.

C

#include <stdio.h> int main() { // printf() displays the string inside quotation printf("Hello World!"); return 0; }

C++

C#

Java

JavaScript:

Python

 

COSC-1336 / ITSE-1302 Computer Science - Author: Dr. Kevin Roark