Groovy learns to mingle with Grails,rundeck.

Source: Internet
Author: User
Tags grails

Fortunately, I've seen Ruby and Java,groovy feel a bit like them before.

And I think this groovy is simpler than Scala (functional programming +obj)

The fastest way to learn is to make an analogy.

XXX, there are compulsory courses and securities from the staff qualification examination, this period is a bit full of ha,,

Tomorrow night with the basketball brothers drinking, and "hacker Corps" to follow up ...

Practice a groovy code, three days without learning, can't keep up with Liu Shaoqi!!!

def message = 12println Messagedef Repeat (Val, repeat= 5){     for(i in 0..) <repeat) {println val}} Repeat ("Hello World") Repeat ("Goodbye Sunshine", 4) def Range= 0.. 4println range.classassertRangeinstanceofListdef Coll= ["Groovy", "Java", "Ruby", "Python"]assertCollinstanceofCollectionassertCollinstanceofArraylistcoll.add ("Perl") Coll<< "Smalltalk"coll[6] = "Ada"assertCOLL[1] = = "Java"def numbers= [1, 2, 3, 4]assertNumbers + 5 = = [1, 2, 3, 4, 5]assertNumbers-[2, 3] = = [1, 4] assertNumbers.join (",") = = "1,2,3,4"assert[1, 2, 3, 4, 3].count (3) = = 2assert["JAVA", "GROOVY"] = =  ["Java", "Groovy"]*. toUpperCase () def Hash= [Name: "Andy", "vpn-#": 45]assertHash.getclass () = =Java.util.LinkedHashMap//hash.put (ID,%)assertHash.get ("name") = = "Andy"Hash.dob= "01/29/76"assertHash.dob = = "01/29/76"def Acoll= ["Groovy", "Java", "Ruby"] for(Iterator iter =acoll.iterator (); Iter.hasnext ();) {println iter.next ()}acoll.each{value-//println Itprintln Value}hash.each {key, value-println"${key}": "${value}"}"Iteration". each{print it.tolowercase ()}def excite= {Word->return"${word}!!"}assert"groovy!!" = = Excite ("Groovy")

Output diagram:

Groovy learns to mingle with Grails,rundeck

.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.