Hello all - have a functional remote receiver prototyped, and I was trying to expand it. Right now I have it responding to a single set of IR codes from a single remote. I want to be able to use a handfull of different remotes, each sending different codes. In the end, I want something along the lines of this pseudo code:
var Off_Codes = asdf,fdsa,qwer,rtyu
if (received_code IN OffCodes){
turn off;
}
etc
I can see how I could do that with nested loops, but it that the right / most efficient/ best way?
While the first one is more succinct, if you want to expand it then there is a lot of repeated code. The second one allows you to expand the number of functions simply by adding more elements in the string.
better can be less code (footprint)
better can be faster
better can be more maintainable
better can be more robust
better can be more understandable
better can be more adaptability
better can be more obfuscated (doubtful but it can)
better can be reusable
better can be more professional
better can be ...... better
As "problem owner" only you can define the measurestick for better ...
The second one is considered good(better) programming practice.
Rob