def objs = [1,2,3,4]
objs.each{
it ->
println it - 1
}
List objs = new ArrayList();
objs.add(new Integer(1));
objs.add(new Integer(2));
objs.add(new Integer(3));
objs.add(new Integer(4));
Iterator x = objs.iterator();
while(x.hasNext()){
Integer nI = (Integer) x.next();
System.out.println("" + nI.intValue() - 1);
}
List objs = new ArrayList();
objs.add(new Integer(1));
objs.add(new Integer(2));
objs.add(new Integer(3));
objs.add(new Integer(4));
Iterator x = objs.iterator();
while(x.hasNext()){
Integer nI = (Integer) x.next();
System.out.println("" + nI.intValue() - 1);
}
List<Integer> objs = new ArrayList<Integer>();
objs.add(1);
objs.add(2);
objs.add(3);
objs.add(4);
// well, really I'd do it with a for loop, e.g. for (int i = 1; 1 <= 4; i++) { objs.add(i); }
// or create a List from an array, so you could pass in {1,2,3,4}
for (int i: objs) {
System.out.println(i - 1);
}
…
public void printHello(String name){
String myString = "hello "+ name +" how are you?\r\n" +
"this is quite hard to read";
System.out.println(myString);
}
…
void printHello(def name){
println """Hello $name,
this is a bit easier to read?"""
}
Want a mud written in the hottest java scripting language? Want to learn a commericial language AND write your own mud?
Check out the GroovyMud mud engine, written in Java with the mud code written in Groovy! The binary is in the mudbytes codebase, but you can also check out the googlecode project at:
http://code.google.com/p/groovymud/
I also need people to help me make the example mud more exciting, and to do alpha testing.. so pile on in!
Cheers
Matt