Answer by John Coleman for Simplify while loop in R
Using the %in% operator, you could replacewhile (sum(diceRoll) != 2 && sum(diceRoll) !=3 && sum(diceRoll) !=12)bywhile (!(sum(diceRoll) %in% c(2,3,12)))The problem with your proposed...
View ArticleSimplify while loop in R
how do I simplify this while loop? It doesn't seem to work when I put != 2 && 3 && 12.Thank youwhile (sum(diceRoll) != 2 && sum(diceRoll) !=3 && sum(diceRoll) !=12)
View Article