"Hello Mars" in 20 Popular Programming Languages

Aug. 24, 2020

The title says it all. I picked these languages as per their popularity from stack overflow developer survey. The ordering below is alphabetical.

1. Assembly

section     .text
global      _start                             


    mov     edx,len                            
    mov     ecx,msg                            
    mov     ebx,1                              
    mov     eax,4                               
    int     0x80                            

    mov     eax,1                              
    int     0x80                                

section     .data

msg     db  'Hello, Mars!',0xa                
len     equ $ - msg                            

2. C

#include <stdio.h>

int main(){
    printf("Hello, Mars!");
    return 0;

3. C++

#include <iostream>

int main(){
    std::cout <<"Hello, Mars!";
    return 0;

4. C#

namespace helloMars{
    class app{
        static void Main(string[] args){
            Console.WriteLine("Hello, Mars!");

5. Dart

void main() {
    print('Hello, Mars!');

6. Go

package main
import "fmt"
func main() {
    fmt.Println("Hello Mars!")

7. Haskell

main :: IO ()
main = putStrLn "Hello, Mars!"

8. Java

class HelloMars{
    public static void main(String[] args){
        System.out.println("Hello Mars!");

9. Javascript

console.log("Hello, Mars!");

10. Julia

println("Hello Mars!")

11. Kotlin

fun main(args: Array<String>) {
    println("Hello Mars!")

12. PHP

echo "Hello, Mars!";

13. Julia

println("Hello Mars!")

14. R

print("Hello, Mars!")

15. Ruby

puts 'Hello, Mars!'

16. Rust

fn main() {
    println!("Hello Mars!");

17. Scala

object Hello {
    def main(args: Array[String]) = {
        println("Hello, Mars!)

18. Swift

print("Hello, Mars!")

19. Typescript

console.log('Hello Mars!');

20. Visual Basic

Imports System

Module HelloMars
    Sub Main()
        Console.WriteLine("Hello Mars!")
    End Sub 
End Module

P.S. If your team is looking to add a fun team member based out from East Coast then please reach out at bondaiblogs@protonmail.com. I have worked with Java and Python stack mostly but open to any. Stay Well!