Author Topic: [SOLVED] while (this is not true) {do this}  (Read 237 times)

0 Members and 1 Guest are viewing this topic.

Offline grahamb314Topic starter

  • Enthusiast
  • Posts: 125
    • View Profile
[SOLVED] while (this is not true) {do this}
« on: September 30, 2008, 02:29:24 PM »
Hi all,

How do i do this:

While this really complex formula is not greater or equal to 10, do this.

I am guessing:
Code: [Select]
while(! complex formula >= 10)
{do this}
In other words while it is not the case that..... do this....
OR:
Code: [Select]
while(complexformula !>= 10)
{do this}

Offline DarkWater

  • Freak!
  • Posts: 6,158
  • Gender: Male
    • View Profile
Re: while (this is not true) {do this}
« Reply #1 on: September 30, 2008, 02:31:16 PM »
The first one would be how you could do this.  I'd use parentheses too:

Code: [Select]
while (!(complex formula >= 10)) {
}

Or you could just use <=... =P
Info:Apache 2.2.4 | PHP 6.0.0-dev, PHP 5.2.4 | Ubuntu 8.04 | Age: 16 | Coding PHP and CSS+(X)HTML: 5-6 years | Feel free to PM me if you need help!
Αν χρειάζεσαι ένας μεταφραστής, μπορέις να μου μιλάς.  Μιλώ καλά.
Quote from: Crayon Violent
If you ask for a banana, would you expect someone to hand you an orange? Or a fork?  No you wouldn't, because you asked for a banana, and you expect them to understand that a banana is not an orange or a fork.  It's the same principle.

Offline grahamb314Topic starter

  • Enthusiast
  • Posts: 125
    • View Profile
Re: while (this is not true) {do this}
« Reply #2 on: September 30, 2008, 02:35:50 PM »
<=

Now thats logical !

Thanks

Offline grahamb314Topic starter

  • Enthusiast
  • Posts: 125
    • View Profile
Re: [SOLVED] while (this is not true) {do this}
« Reply #3 on: September 30, 2008, 02:36:47 PM »
Actually it's just <

 :)

Offline DarkWater

  • Freak!
  • Posts: 6,158
  • Gender: Male
    • View Profile
Re: [SOLVED] while (this is not true) {do this}
« Reply #4 on: September 30, 2008, 02:44:34 PM »
Actually it's just <

 :)

My bad, forgot about the = on the original one and wasn't really thinking.
Info:Apache 2.2.4 | PHP 6.0.0-dev, PHP 5.2.4 | Ubuntu 8.04 | Age: 16 | Coding PHP and CSS+(X)HTML: 5-6 years | Feel free to PM me if you need help!
Αν χρειάζεσαι ένας μεταφραστής, μπορέις να μου μιλάς.  Μιλώ καλά.
Quote from: Crayon Violent
If you ask for a banana, would you expect someone to hand you an orange? Or a fork?  No you wouldn't, because you asked for a banana, and you expect them to understand that a banana is not an orange or a fork.  It's the same principle.