coding if loops

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Nov 2004
Posts: 15
Reputation: matt_5104 is an unknown quantity at this point 
Solved Threads: 0
matt_5104 matt_5104 is offline Offline
Newbie Poster

coding if loops

 
0
  #1
Jan 23rd, 2005
How do I code an IF loop to perform the following?:

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

Thanks!!
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: coding if loops

 
0
  #2
Jan 23rd, 2005
  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?
Reply With Quote Quick reply to this message  
Join Date: Jul 2004
Posts: 1,749
Reputation: nanosani is an unknown quantity at this point 
Solved Threads: 54
Team Colleague
nanosani's Avatar
nanosani nanosani is offline Offline
Unauthenticated Liar

Re: coding if loops

 
0
  #3
Jan 24th, 2005
is IF a loop ??? heard it for the first time ??
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 33
Reputation: pajac is an unknown quantity at this point 
Solved Threads: 0
pajac's Avatar
pajac pajac is offline Offline
Light Poster

Re: coding if loops

 
0
  #4
Jan 24th, 2005
Looks like conditional statment to me ??
::: Ha thisone nobody has! :lol: :lol:
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: coding if loops

 
0
  #5
Jan 24th, 2005
It can be used as a recursive function. I guess that's what he was talking about...Maybe...?
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 33
Reputation: pajac is an unknown quantity at this point 
Solved Threads: 0
pajac's Avatar
pajac pajac is offline Offline
Light Poster

Re: coding if loops

 
0
  #6
Jan 24th, 2005
Hm........now u got us!!!
::: Ha thisone nobody has! :lol: :lol:
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: coding if loops

 
0
  #7
Jan 25th, 2005
  1. 10 a=1
  2. 20 if (a=1) goto 10

Loopy enough? Not Java of course
Reply With Quote Quick reply to this message  
Join Date: Jan 2005
Posts: 33
Reputation: pajac is an unknown quantity at this point 
Solved Threads: 0
pajac's Avatar
pajac pajac is offline Offline
Light Poster

Re: coding if loops

 
0
  #8
Jan 25th, 2005
Originally Posted by jwenting
  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.
::: Ha thisone nobody has! :lol: :lol:
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC