![]() You may simulate the default case by having a status variable telling whether a match was found in the loop or not.The advantage of this approach is that the code to execute for each class is arbitrary, like the one in the switch statement in your example all the cases performed a similar operation, but tomorrow you may need to do different things for each. ![]() Having no break after fnsi allows the code to be executed whenever there is a match - so that if the element has, f.i., class1 and class2, both fn1 and fn2 will be executed. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |