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

need help for the If condition.  RSS feed

 
Joy Vergis
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


I get the output for the below program as
The value of a:0




The default value for int types is 0. So why i get output for only a.
 
Mohamed Sanaulla
Bartender
Posts: 3179
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you notice in your program- Both the statements print the same message
 
Rob Spoor
Sheriff
Posts: 21090
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
a and b are both 0. That means that a<b is false, so the else statement is executed. And although you're printing the value of b (0) you say it's the value of a. Just check the String.>
 
Adrabi Abderrahim
Greenhorn
Posts: 8
Eclipse IDE Fedora Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

Change "a" in line 9 to "b" :

to
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!