Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 9th, 2012  |  syntax: None  |  size: 0.27 KB  |  hits: 6  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Making a conditional loop condition?
  2. if (c = true)
  3. {
  4.    while(a<b)
  5.    {
  6.    }
  7. }
  8. else
  9. {
  10.    while(b<a)
  11.    {
  12.    }
  13. }
  14.        
  15. while ((c && a < b) || (!c && b < a)) {
  16.     // ...
  17. }
  18.        
  19. while (c ? (a < b) : (b < a)) {
  20.     // ...
  21. }
  22.        
  23. while( c && a<b || !c && b<a )
  24. {
  25.   ...
  26. }