Two Quick question!

1. Can i use... or ill just show it in a code!

if (ww==1-10000)

So is it possible to range value in if question?
if this is not right, is there any other way to do it
----------------------------------------------------------------------------
2. Can if have multiple questions? like this:

if (ww==10||ee!=20||rr<30)

Thank you for your help!

1. This will be treated by the compiler as
 
if (ww==9999)

what you want to check if ww is in the range 1 to 10000 is
 
if ((ww>=1) && (ww <=10000))


2. Yes (see 1 above!). It is perfectly OK to omit the extra brackets as per your example, but if yuo start to get more coplext expressions you need to think about operator precedence - so I tend to always put the brackets in to make it clear (both to anyone reading the code, and to me, 6 months later:-)
Last edited on
Thank you very much, i should have figured the 1. question myself =/.
No problem, glad to help. Sometimes the obvious can be very hard to spot yourself:-)

Topic archived. No new replies allowed.