Coding



$vi helloworld.s
#Assembly - Hello world in Linux IA-32 assembly #Assembler: gas (GNU assembler) #Linker: ld (GNU ld) .section .data helloworld: .ascii "Hello world.\nThanks for visiting.\n" .section .text .globl _start _start: movl $1, %ebx movl $helloworld, %ecx movl $34, %edx movl $4, %eax int $0x80 movl $1, %eax movl $0, %ebx int $0x80 $as -o helloworld.o helloworld.s $ld -o helloworld helloworld.o $./helloworld
$vi helloWorld.c
//C - Hello world in C //Compiler: GCC #include <stdio.h> int main(int argc, char *argv[]) { printf("Hello world.\nThanks for visiting!\n"); }
$gcc -o helloWorld helloWorld.c $./helloWorld
$vi helloWorld.cc
//C++ - Hello world in C++ //Compiler: GCC #include <iostream> int main() { std::cout << "Hello world.\nThanks for visiting.\n"; }
$g++ -o helloWorld helloWorld.cc $./helloWorld
$vi HelloWorld.java
//Java - Hello world in Java //Compiler: Java compiler (javac via JDK) public class HelloWorld { public static void main(String[] args) { System.out.println("Hello world.\nThanks for visiting."); } }
$javac HelloWorld.java $java HelloWorld
$vi helloWorld.lisp
;Lisp - Hello world in lisp ;Interpreter: CLISP (print "Hello World")
$clisp helloWorld
$vi helloWorld.tcl
#Tcl/Tk - Hello world in Tcl #Interpreter: Wish #!/usr/bin/wish button .b -text "Hello World!" -command exit pack .b
$wish helloWorld.tcl
$vi helloWorld.lua
#Lua - Hello world in Lua #Interpreter: Lua print("Hello World!")
$lua helloWorld.lua
$vi helloWorld.pl
#Perl - Hello world in Perl #Interpreter: Perl print "Hello World!"
$perl helloWorld.pl
$vi helloWorld.py
#Python - Hello world in Python #Interpreter: Python version 2 print "Hello World!"
$python helloWorld.py
$vi helloWorld.py
#Python - Hello world in Python #Interpreter: Python version 3 print( "Hello World!")
$python3 helloWorld.py
$vi helloWorld.xml
<!--XML - Hello world message in XML--> <?xml version = 1.0"?>
<message>
   <to>you visitors</to>
   <from>Derek Devaughn</from>
   <subject>A simple message</subject>
   <text>Hello World!</text>
</message>

$vi helloWorld.html
<!--HTML - Hello world message in HTML--> <!DOCTYPE html> <html>
   
   <head>
      <meta charset="utf-8">
      <title>A simple message</title>
   </head>
<body> Hello World! </body> </html>

$vi helloWorld.php
//PHP - Hello world in PHP
//Interpreter: PHP
<?php
   echo "Hello World!\n";
?>
$php helloWorld.php
$vi helloWorld.sh
//Bash - Hello world in bash //Interpreter: Bash #!/bin/bash echo "Hello World!" $chmod +x hello.sh $./hello.sh
$vi helloWorldJS.html
<!--JavaScript - Hello world message in JavaScript embedded in HTML--> <!DOCTYPE html> <html>
   
   <head>
      <meta charset="utf-8">
      <title>A simple message</title>
   </head>
<body> <script type="text/javascript"> document.write("Hello World!") </script>
<noscript> Sorry your browser doesn't support (or disabled) my JavaScript greeting. </noscript> </body> </html>

#One way to print Hello World in Awk
$echo '"Hello World!"' > helloAwk $awk '{print}' helloAwk