Lets say you are iterating through database records and one of columns is "id"

def id = resultSet.id

Or from the original blog post:

def books = new XmlSlurper().parse("books.xml")
books.book.each {
    println "Title = ${it.title}, Author: ${it.author.@firstname}
${it.author.@lastname}"
}

import groovy.sql.Sql
sql = Sql.newInstance("jdbc:mysql://host/db", "username", "password",
"com.mysql.jdbc.Driver")
sql.eachRow("select * from tableName", { println it.id + " --
${it.firstName} --"} )



On Sun, May 8, 2011 at 11:25 AM, Josh Berry <[email protected]> wrote:
> On Sun, May 8, 2011 at 9:30 AM, phil swenson <[email protected]> wrote:
>> well the article was called "java.next()"
>>
>> But why not have the best of both worlds?  Static typing/type
>> inference.  Optional dynamic typing where it makes sense.
>
> Within a given program, I'm curious of an example where dynamic typing
> actually "makes sense."  Wasn't there a study that showed even in
> traditional dynamic languages, the majority of the runtime behavior
> was consistent with a static type model?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "The Java Posse" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/javaposse?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to