Re: Simple syntax question



somebody wrote:
Is this the best we to conditionally do something if str is NOT equal to
one, two, three, or four, AND mystr is NOT equal to X? I can't seem to
find anything like a str.unequal. I want the if block to execute if str
equals "seven" and mystr equals "Y"


if ( !(str.equals("one")) && !(str.equals("two")) && !(str.equals("three")) && !(str.equals("four")) &&
(mystr.compareTo("X") != 0) )
{

Then do this...


-Thanks


Ugly isn't it? You don't need the parenthesis around the String.equals() to protect the !, you can just write !String.equals().

Also remember that !a && !b == !(a || b).

--

Knute Johnson
email s/nospam/knute/

--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDem
.



Relevant Pages