I came to Objective-C from the VB.NET background, where the switch Select Case switch , and the break statements are not needed (or possible).
I know that the general rule is to place the break statement at the end of each case so that the execution does not โfailโ in the next case .
When writing iOS applications, I often have switch in my -tableView: heightForRowAtIndexPath: methods. Basically, I often let my cells report the required height, so in the end I get the following switch :
switch (indexPath.row) { case 0: return ... break; case 1: return ... break; ... default: return ... break; }
I saw this answer , which makes sense to me and is what I expect from the answer, but this question is about Java, and I wanted to see if the same answer persists for Objective-C.
I also found this answer that relates to C, which I believe is the correct answer for Objective-C.
So, is this a return specialized break statement?
objective-c switch-statement return
mbm29414
source share