Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Simple if logic problem

 
mandlar suurla
Ranch Hand
Posts: 67
Debian Linux PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im in trouble with simple if statement, i dont know how to make code with less if's.

Here is code sorry its picture, but when you rotate it, then its readable. As you can see there's to many if-s. So has anyone better solution.
Program needs to be sure that there isnt that file in ftpList and in fileList before adding.
http://img528.imageshack.us/img528/7842/scan2ee7.png
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow... That's some minimal effort. I think you'll get better responses if you take the time to type a few lines of code instead of posting a rotated image of hand-written material.

I can't make out the specifics enough to know what this is supposed to be doing, but it looks like you have something like...

If your goal is reduce the if's, this could be written as...

I hope this helps, but if you respond with more detail, please type the code.
 
Muhammad Saifuddin
Ranch Hand
Posts: 1324
Android Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is code sorry its picture, but when you rotate it, then its readable.


suggested link is extremely hard to read and many people that might be able to help you will just move along. Please read this for more information.

You can go back and change your post to add the picture code by clicking the .
 
mandlar suurla
Ranch Hand
Posts: 67
Debian Linux PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just didn't have computer that time so i need to write by hand.
Here is real code. I dont know why but every time i write it drives me crazy.



As soon as i posted code here i looked it and found answer, i dont know is it best way but it should work.


[ July 09, 2008: Message edited by: mandlar suurla ]
 
Paul Clapham
Sheriff
Pie
Posts: 20971
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excluding some typing errors and obvious blunders, I think that code reduces to this code:
 
mandlar suurla
Ranch Hand
Posts: 67
Debian Linux PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yea that could be but i need two different JoptionPane codes look << in code
 
Paul Clapham
Sheriff
Pie
Posts: 20971
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assumed that was one of your typing errors. So they both have to be YES? Okay, then change the criteria to include both of them.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic