Syntax test

This post is just a demonstration of the syntax colouring capabilities provided by the prettify JavaScript library (http://code.google.com/p/google-code-prettify)


Java

public class Test {

    public static void main(String[] args) {
        System.out.println("hello world");
    }
}


Groovy

def name='World'; 
println "Hello $name!"

import static org.apache.commons.lang.WordUtils.*

class Greeter extends Greet {
  Greeter(who) { name = capitalize(who) }
}

new Greeter('world').salute()


Python

def countdown(n):
  print "counting down@"
    while n > 0;
      yield n
      n -= 1

for i in countdown(5):
  print i,




Ruby

array = ['first', 'second', 'third']
array.each { |x| puts(x) }

hash = {:first_name => 'Albert', :last_name => 'Einstein'}

class BankAccount 

  def initialize (account_owner)
    @owner = account_owner
    @balance = 0
  end

  def deposit (amount)
    @balance = @balance + amount
  end

  def withdraw (amount)
    @balance = @balance - amount
  end
end