...

View Full Version : if else statment syntax



havey
07-08-2006, 10:29 PM
hi, a beginner question, i can use and in an if statement like so:
if (time>=10 && time<16)

how can i say or:

if (time>=10 or time<16)

thanks

coothead
07-08-2006, 10:49 PM
Hi there havey,

Why do you want to say...

if (time>=10 or time<16)
...as this would include all values of time.

if (time>=10 && time<16)
Will provide the values of time 10 to 15 inclusive.

coothead

vwphillips
07-09-2006, 12:11 AM
as coothead points out, does not make much sence in your example but

the Javascript symbol for or is ||

if (time>=10 || time<16)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum