How do I code an IF loop to perform the following?:

if a > X
b = //a value//
else
b = //another value//

Thanks!!

int a = 5;
int b = 7;

if (a > b)
{
   b += 1;
}
else 
{
  b -= 1;
}

Is this what your talking about?

is IF a loop ??? heard it for the first time ?? :D

Looks like conditional statment to me ;) ??

It can be used as a recursive function. I guess that's what he was talking about...Maybe...?

Hm........now u got us!!! ;)

10 a=1
20 if (a=1) goto 10

Loopy enough? Not Java of course ;)

10 a=1
20 if (a=1) goto 10

Loopy enough? Not Java of course ;)

We had Prolog last semester..... Rekursion is not my favorite, but it'll go. :cool:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.