How can I get the While function to evaluate two conditions simultaneously?


You want to use Or rather than And. Then you are printing are all of the failures and the final success.

Clear("Global`*")

a = 1; b = 1; n = 1;

SeedRandom(12)

While(a < 6 || b < 6, a = RandomInteger(10); b = RandomInteger(10); 
 Print("Try ", n++, ": a = ", a, ", b = ", b))

(* Try 1: a = 2, b = 4

Try 2: a = 0, b = 10

Try 3: a = 1, b = 9

Try 4: a = 7, b = 3

Try 5: a = 1, b = 10

Try 6: a = 7, b = 0

Try 7: a = 9, b = 5

Try 8: a = 4, b = 6

Try 9: a = 7, b = 2

Try 10: a = 8, b = 5

Try 11: a = 4, b = 7

Try 12: a = 8, b = 8 *)