Have you ever wondered why every programming tutorial or book starts with a simple program called "Hello World"? This program is very simple and only prints the message "Hello World" to the screen, but it has a deep meaning for programmers.
In this article, we will cover a simple "Hello World" program in various programming languages. Through this article, we will explore the syntax of different programming languages used to create a simple "Hello World" program. Let's get started!
1. C++
#include <iostream>
int main() {
std::cout << "Hello World!";
return 0;
}
2. Java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
3. Python
print("Hello World!")
4. JavaScript
console.log("Hello World!");
5. Ruby
puts "Hello World!"
6. PHP
<?php
echo "Hello World!";
?>
7. Swift
print("Hello World!")
8. Rust
fn main() {
println!("Hello World!");
}
9. Go
package main
import "fmt"
func main() {
fmt.Println("Hello World!")
}
10. Brainfuck
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
11. Perl
print "Hello World!\n";
12. Kotlin
fun main() {
println("Hello World!")
}
13. Lua
print("Hello World!")
14. Dart
void main() {
print("Hello World!");
}
15. Bash
echo "Hello World!"
16. Assembly
section .data
hello db 'Hello World!',0
section .text
global _start
_start:
mov eax, 4 ; write system call
mov ebx, 1 ; stdout file descriptor
mov ecx, hello ; message to write
mov edx, 13 ; message length
int 0x80 ; call kernel
mov eax, 1 ; exit system call
xor ebx, ebx ; exit status code
int 0x80 ; call kernel
17. Pascal
program HelloWorld;
begin
writeln('Hello World!');
end.
18. TypeScript
console.log("Hello World!");
19. Julia
println("Hello World!")
20. R
cat("Hello World!\n")
21. Crystal
puts "Hello World!"
22. Elixir
IO.puts "Hello World!"
23. Groovy
println "Hello World!"
24. Scala
object HelloWorld {
def main(args: Array[String]): Unit = {
println("Hello World!")
}
}
25. Ada
with Ada.Text_IO; use Ada.Text_IO;
procedure Hello_World is
begin
Put_Line("Hello World!");
end Hello_World;
The world of programming languages is vast and diverse, ranging from the most widely used to the least known. We hope that this article has provided you with an interesting insight into the "Hello World" program in various programming languages.
If you have any additional "Hello World" examples in other programming languages or any feedback on this article, please feel free to leave a comment. We welcome your contributions and look forward to hearing from you.
Top comments (0)