Thanks to both. This is just a simple example. In real I have two vectors with different lengths. The code consists of two for loops for r and z. The main problem is the computational time, so I try to stop the loop if w is TRUE for the first time.
First I tried to use the command "stop" in combination with the two for loops, but then my whole script stoped. The script not only consists of this stuff. -- View this message in context: http://r.789695.n4.nabble.com/While-loop-working-with-TRUE-FALSE-tp4348340p4348490.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.