SyntaxHighlight

Apt modifica

#example of /etc/apt/sources.list
deb http://lang.mirror.distro.com/distroname/ release contrib non-free
deb-src ftp://another.mirror.com/distro/src/ release main multiverse

Asm modifica

mov eax, ecx ; eax = ecx
push eax
call _sqrt

Bash modifica

if [ -f /dev/null ]; then
 echo $0 # echo shell name
else
 for i in `seq 0 10`; do
 echo $((i++))
 done
fi

C modifica

#include <stdio.h>
#define LEN 10

/* useless program */
int main(int argc, char *argv[])
{
   int i;
   for (i = 0; i < LEN; i++) {
       fprintf(stdout, "%d", i);
    }

   return 0;
}

C++ modifica

#include <iostream>
using namespace std;

int main()
{
   cout << "Hello World!\n"; // print "Hello World!"
   return 0;
}

HTML modifica

<html>
<head>
<title>A Web page</title>
</head>
<body>
<a href="http://it.wikipedia.org/" alt="L'enciclopedia libera">Wikipedia</a> <!-- l'enciclopedia libera -->
</body>
</html>

LaTeX modifica

\documentclass[a4paper, 11pt]{article}

\usepackage[utf8]{inputenc}
\usepackage[italian]{babel}

\begin{document}
Hello World in \LaTeX % commento
\end{document}

Objective-C modifica

#include <stdio.h>
#import <Foundation/Foundation.h>

@interface MyObject: NSObject
{
@public
    int a;
@private
    BOOL b; // YES or NO
@property float this, that;
-(void) print;
-(int) get;
@end

@implementation MyObject
@synthesize this, that;
-(void) print
{
   printf("%d", [self get]);
}
-(int) get
{
   return a;
}
@end

Java modifica

public class Prova {
    /** Useless class
     *  An "Hello World!" program
     */
    public static void main(String args[]) {
        boolean value = true;
        String hello = "Hello ";
        char array[] = { 'W', 'o', 'r', 'l', 'd', '!', '\n' };

        if (value) {
            System.out.println(hello);
            for (int character : array) {
                System.out.printf("%c ", character); // W o r l d !
            }
        }
    }
}