HomeGenie Forum
General Category => Troubleshooting and Support => Topic started by: bkenobi on February 19, 2014, 03:48:22 PM
-
Can you explain why sometimes the following code returns true and others false? I'm not sure how the statement is used in this scenario.
var smart_devices = Modules.WithFeature(SMART_LIGHT_ENABLE);
smart_devices.Each((mod)=>
{
if (module.Instance.Name=="Entry Light"))
{
//code to do stuff
...
}
return true;
});
-
If you return true, the iteration will break. If you return false, it will continue iterating to the next element in the selection.
I made a correction the the api docs so it should be more clear:
http://www.homegenie.it/docs_old/api/modules.html#each
g.
-
That makes sense. Thanks!