This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

if conditon  RSS feed

 
naga eswar
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have small situation,

if there is if condition,
for example,




here if x= 0 then if conditon will executes and the control should forward to some jsp file and the below statements of if condition should not execute. can anybody help me.


 
Paul Clapham
Sheriff
Posts: 22487
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Might I suggest an "else" clause if you don't want something to execute when the if-condition is true?
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are asigning the value of 0 to x

x = 0;

if (x == 0) { ... Note the double ==

WP
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
another way :
assume your if statement is executing..

If you dont want to execute statements that are after the if statement. put return as last statement in if.
 
naga eswar
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry bear, I wont repeat.

well i am really sorry , now i will give you clear strucure.




now in else part, we have forwarded control to Jsp page2.
Once this condition (y==1), the below statements shold not execute and the control should stops at jsp page.
Please help me.

 
Paul Clapham
Sheriff
Posts: 22487
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Come on, you just need another else.



 
naga eswar
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
problem got solved thanks to all.
 
dennis deems
Ranch Hand
Posts: 808
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whenever I'm having trouble organizing a conditional efficiently, I construct a Karnaugh map. The regions of the map translate to branches in my if statements.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!