URL: http://hansamann.podspot.de/files/grails_podcast_episode_40.mp3
This snippet gives you some interesting examples about Groovy Control Structures. Listen to the audio to get the best learning experience. Simply right-click on the title above to download the mp3 file of this part of the series.
The Groovy Series is part of the Grails Podcast and can be subscribed to via: http://hansamann.podspot.de/rss. The series is produced by Dierk König and Sven Haiges, further information about the topic of this episode can be found in the book
Groovy in Action - http://groovy.canoo.com/gina
//if / else if / else //conditional ?: //powerful switch statement, isCase() :-) } //java.lang.Class contains an isCase() method, we can classify by class someValue = 5.5 feedback = '' default: feedback = 'You are using an unknown number type!' } //switching on Lists someValue = 4 feedback = '' } //matcher with switch someValue = 'Hello World' feedback = '' } //for //pretty standard java5 for loop in groovy result += item } //using ranges in for loops result << character } //using for with a matcher //classic for loops will come with groovy 1.1 :-)
You need to login to post a comment.
