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