Skip to content

Instantly share code, notes, and snippets.

@jesslilly
Last active August 29, 2015 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jesslilly/9663304 to your computer and use it in GitHub Desktop.
Save jesslilly/9663304 to your computer and use it in GitHub Desktop.
Just a little groovy exploration
#!/usr/bin/env groovy
// GROOVY STYLE!!!!!!!!!!!!!!!!
def a = new ArrayList<String>()
a.add("Hello")
a.add("my")
a.add("name")
a.add("is")
a.add("Jess")
def tabs = ""
for (String word in a) {
println tabs + word + " "
tabs += "\t"
}
println a.join(" ") + "!"
#!/usr/bin/env groovy
// JAVA STYLE!!!!!!!!!!!!!!!!
ArrayList<String> a = new ArrayList<String>();
a.add("Hello");
a.add("my");
a.add("name");
a.add("is");
a.add("Jess");
String tabs = "";
for (String word in a) {
System.out.println(tabs + word + " ");
tabs += "\t";
}
System.out.println(a.join(" ") + "!");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment