please for advice. It is possible to do simpliest code than this?
B4X:
receivecode=1
If receivecode=1 then
if mydevice1=56 then "start"
if mydevice1=153 then "stop"
End if
If receivecode=2 then
if mydevice2=56 then "start"
if mydevice2=153 then "stop"
End if
........
It is possible to write with B4R something like...
receivecode=1
if mydevice(receivecode)=56 then "start"
if mydevice(receivecode)=153 then "stop"
but (my bad english) there is another question...
I want put the number from receivecode to the IF condition ....If mydevice(receivecode)=56 then something
Dim mydevices(2) As Int
'mydevices(0) = 56 Or 153 set by either by a direct assignment or by a Subroutine
'mydevices(1) = 56 Or 153 set by either by a direct assignment or by a Subroutine
'Then you use
If mydevices(receivecode) = 56 then
'...
Else If mydevices(receivecode) = 153 then
'...
End If
'Or
Select mydevices(receivecode)
Case 56
'...
Case 153
'...
End Select
There are a few important differences between B4R and other B4X products, but the language syntax is the same.
I recommend the Booklets by Klaus (see Documentation at the top of this screen), in particular...
B4X Getting Started - This booklet explains how to start with each B4X product (B4A, B4i, B4J and B4R). B4X Basic Language - This booklet explains the Basic Language for B4A, B4i, B4J and B4R.