sendCommand() expression

I need to increase my device item “Volume” by a specific amount and I was trying to do that directly in the sendCommand:

Volume.sendCommand(Volume.state+5)

But this give me an error "Unknown variable or command ‘+’ "

The workaround is to use a variable

var Number Vol = Volume.state
Vol = Vol + 5
Volume.sendCommand(Vol)

I was wondering if there is a way to have an expression as the sendCommand argument and if yes what will be the proper syntax for my specific problem?

Volume.sendCommand(Volume.state as Number + 5)

The rules engines seems to work out what operators are “allowed” from the type of object it is handling, in this case item.state
Note that in your working example, the state is cast to a Number object.
This should do the trick -
Volume.sendCommand( (Volume.state as Number) + 5)

It does work. Thanks to both of you.

Any recommendation where I could find the documentation to address such basic syntax question?

The most useful resource is searching this forum for examples. As well as problem+solution posts like this one, where even the struggles inbetween can be educational, there are useful guides like

Forum is great and I found the xtend documentation that helps as well https://www.eclipse.org/xtend/documentation/203_xtend_expressions.html