Women in Technology

Hear us Roar



Article:
  Lisp and Java
Subject:   Groovy can do it
Date:   2004-03-26 07:11:57
From:   stefan.arentz

This is a little example of how you would do the same thing in Groovy (http://groovy.codehaus.org)



import groovy.sql.Sql
import groovy.sql.TestHelper


foo = 'cheese'
sql = TestHelper.makeSql()


sql.eachRow("select * from FOOD where type=${foo}") {
println "Gromit likes ${it.name}"
}


Groovy can be used within a Java environment or standalone. Very nice language if you want something more flexible than Java. It runs in the same Java VM so it can use/connect to existing code and libraries.