Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Code that says 'Not equals'  RSS feed

 
Michael Scott
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there code that is the converse of the following which does not rely on an Else clause?

if (animal.equals("cat") )

I thought this might be expressed as something such as the following. This is not valid though.

if not(animal.equals("cat") )

Thanks.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12542
48
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if !(animal.equals("cat") )
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66207
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually:


[ May 14, 2007: Message edited by: Bear Bibeault ]
 
fred rosenberger
lowercase baba
Bartender
Posts: 12542
48
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oops... sorry.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!