Named arguments (parameters) in functions or closures

By neokrates, written on June 3, 2010

groovy   snippet

Rate it
  • 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
    Loading ... Loading ...
Ad
Poll
  • Do you plan to migrate to new SCM?

    • Our current SCM is just perfect (69%, 9 Votes)
    • Subversion (SVN) (15%, 2 Votes)
    • Git (8%, 1 Votes)
    • Mercurial (Hg) (8%, 1 Votes)
    • Bazaar (0%, 0 Votes)
    • Other (0%, 0 Votes)

    Total Voters: 13

    Vote

    Loading ... Loading ...
Feeds:
  • bodytext bodytext bodytext
Most popular search terms:
1
2
3
4
5
6
final launchRemoteControl ( p=[p1 : 'Micro', p2:"And", p3 : "Soft" ]) {
    println p.p1 + p.p2 + p.p3
}
 
launchRemoteControl()
launchRemoteControl(p1:'Soft', p2:'', p3:'Micro')


[!!] Currently, there is a limitation that if you skip one name, it will be missed in function as well (because you actually replace default map as whole)

launchRemoteControl(p1:'Soft', p3:'Micro')
 
Does that help to solve your problem?
VN:F [1.8.5_1061]
Rating: 0 (from 0 votes)
0 votes 'YES'  0 votes 'NO'
TAGS
No tags for this post.
RELATED
Pages
Posts
    nope :(
SOCIAL
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • BlinkList
  • Blogosphere News
  • E-mail this story to a friend!
  • Furl
  • LinkArena
  • Live
  • MisterWong
  • Print this article!
  • StumbleUpon
  • Technorati
  • Webnews.de
  • YahooMyWeb

Leave a Reply