Le mercredi 01 février 2012 à 07:55 -0800, Chris82 a écrit : > Hi R users, > > is there any possibilty that a while loop is working like that: > > z <- c(0,1,2,3,4,5,6,7,8,9) > r <- 7 > > while(w == T) { > for ( i in 1:10 ){ > w <- r == z[i] > print(w) > } > } What problem are you trying to solve? In R, loops should generally be avoided, and you have much simpler syntax for most cases.
> The loop should stop if w == TRUE Your while loop stops when w == FALSE here. Anyway, it won't run since w isn't set the first time the condition is tested. And I really don't see why you have two embedded loops here. Cheers ______________________________________________ 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.