Proper way to test a state numeric value

Hi,

If I want to test an items state for being greater then 0 but less then 15 what is the correct syntax?

If(Lux.state > 0 && Lux.state < 15) {
//do something
}

Some script examples iv’e seen show how powerful the language is so I wonder if the above is a bit of a bloated way to acheive this.

Thanks

If Lux is a number-item and you use 2.3 it sould work.

Yes it does work but as I’m new to openhab2 scripting moving forward I just wondered if there was a more efficient way of writing it.

In the past the syntax was

If ((Lux.state as DecimalType) > 0 && (Lux.state as DecimalType) < 15) {

so I think this is a proper way and it’s java like.

Great - thanks

I’m trying not to learn bad habits or lazy coding.