[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Swarm-Modelling] Break Command
From: |
Marcus G. Daniels |
Subject: |
Re: [Swarm-Modelling] Break Command |
Date: |
Wed, 20 Dec 2006 15:22:53 -0700 |
User-agent: |
Thunderbird 2.0b1 (Windows/20061206) |
Diego Corredor wrote:
1. I'm trying to break a loop if a certain condition is met during
this process. To do so I have been using the java command "break"
without result. Is there any special command in javaswarm to break a
loop?
break should work fine, as below:
public class pony {
public static void main (String args[]) {
for (int i = 1; i <= 5; i++) {
System.out.println ("I want a pony! I want a pony!");
if (i == 3) {
System.out.println ("ok, http://mingyeeiu.googlepages.com/ponies");
break;
}
}
}
}
2. I need to randomize the order of a ListImpl object. I found the
ListShuffleImpl method in the Reference Guide, but I have not found
out how to make it work yet...
Another way to do it is to use a randomizing index, e.g. use
"beginPermuted" instead of "begin" for creating and index from a list.