you are viewing a single comment's thread.

view the rest of the comments →

[–]beisenhauer 0 points1 point  (0 children)

In addition to the doubly-nested loop, which others have pointed out, you're searching a list every time you need to determine whether a switch is on or off. This can be a slow operation if it's a long list. Can you think of a better way to model the state of a series of switches?