Hello World! A Simple Program in Every Programming Language
December 07, 2022 • 2 min read
One of the first programs that many people learn to write is a program that simply prints the text "Hello, World!" to the screen. This program is often used as a simple way to get started with a new programming language, as it demonstrates the basic syntax and structure of the language.
Here is a list of "Hello, World!" programs in a variety of popular programming languages:
C:
#include <stdio.h>
int main(void) {
printf("Hello, World!\n");
return 0;
}
C++:
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
}
Java:
public class HelloWorld
{
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
Python:
print("Hello, World!")
JavaScript:
console.log('Hello, World!')
PHP:
<?php
echo "Hello, World!";
?>
Ruby:
puts "Hello, World!"
Swift:
print("Hello, World!")
Kotlin:
fun main(args: Array<String>) {
println("Hello, World!")
}
C#:
using System;
namespace HelloWorld {
class Program {
static void Main(string[] args) {
Console.WriteLine("Hello, World!");
}
}
}
Go:
package main
import "fmt"
func main() {
fmt.Println("Hello, World!")
}
Perl:
print "Hello, World!\n";
Matlab:
disp('Hello World');
Dart:
main() {
print('Hello World');
}
Scala:
object HelloWorld extends App {
printIn("Hello World")
}
Assembly:
global _main
extern _printf
section .text
_main:
push message
call _printf
add esp, 4
message:
db 'Hello World', 10, 0
R:
cat('Hello World')
Bash:
echo "Hello, World!"
I hope this list of "Hello, World!" programs in various programming languages helps you get started with baby panda codes! Remember, every journey towards becoming a proficient coder begins with a single step, and printing "Hello, World!" is a crucial first step in your journey. So go ahead and give it a try – you'll be amazed at how much you can learn from such a simple program!
Category - Browse all categories
About Baby Panda Codes
Full-Stack Engineer
Baby Panda Codes is an experienced Full-Stack Engineer and trainer, focusing on code quality.