944,149 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 4006
  • Java RSS
Jan 23rd, 2005
0

coding if loops

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

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

Thanks!!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
matt_5104 is offline Offline
15 posts
since Nov 2004
Jan 23rd, 2005
0

Re: coding if loops

Java Syntax (Toggle Plain Text)
  1. int a = 5;
  2. int b = 7;
  3.  
  4. if (a > b)
  5. {
  6. b += 1;
  7. }
  8. else
  9. {
  10. b -= 1;
  11. }
Is this what your talking about?
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Jan 24th, 2005
0

Re: coding if loops

is IF a loop ??? heard it for the first time ??
Team Colleague
Reputation Points: 45
Solved Threads: 56
Unauthenticated Liar
nanosani is offline Offline
1,767 posts
since Jul 2004
Jan 24th, 2005
0

Re: coding if loops

Looks like conditional statment to me ??
Reputation Points: 10
Solved Threads: 0
Light Poster
pajac is offline Offline
33 posts
since Jan 2005
Jan 24th, 2005
0

Re: coding if loops

It can be used as a recursive function. I guess that's what he was talking about...Maybe...?
Reputation Points: 113
Solved Threads: 19
Postaholic
server_crash is offline Offline
2,108 posts
since Jun 2004
Jan 24th, 2005
0

Re: coding if loops

Hm........now u got us!!!
Reputation Points: 10
Solved Threads: 0
Light Poster
pajac is offline Offline
33 posts
since Jan 2005
Jan 25th, 2005
0

Re: coding if loops

Java Syntax (Toggle Plain Text)
  1. 10 a=1
  2. 20 if (a=1) goto 10

Loopy enough? Not Java of course
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Jan 25th, 2005
0

Re: coding if loops

Quote originally posted by jwenting ...
Java Syntax (Toggle Plain Text)
  1. 10 a=1
  2. 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.
Reputation Points: 10
Solved Threads: 0
Light Poster
pajac is offline Offline
33 posts
since Jan 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Program Compiles fine, but error upon Running
Next Thread in Java Forum Timeline: SAX XML reader





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC