Hi, << A switch statement cannot jump a successive number of lines but my little example can. >>
Rereading my previous email, I think this is a mistake on my part. A switch's default clause can be used to execute such a number of lines. The only thing that a switch cannot do is use a non-constant object as its case control value. I am sending this to avoid readers responding to explain something a short reading about the switch statement can easily teach within a few minutes. Edward On 25/06/2016, Edward Bartolo <[email protected]> wrote: > Hi, > > With a switch statement execution continues immediately after the > switch. My example also involved a chunk of code that followed the > series of if statements that was also skipped by the goto jump. A > switch statement cannot jump a successive number of lines but my > little example can. In fact, I used it back in 1995 when I programmed > an expression evaluator. > > Edward > > On 25/06/2016, Edward Bartolo <[email protected]> wrote: >> om: Edward Bartolo <[email protected]> >> Hi, >> >> On 25/06/2016, KatolaZ <[email protected]> wrote: >>> On Sat, Jun 25, 2016 at 09:27:40AM +0200, Edward Bartolo wrote: >>> >>> [cut] >>> >>>> >>>> execution continues from here >>>> >>>> This can still be done by something like this: >>>> do { >>>> if (test1) break; >>>> if (test2) break; >>>> if (test3) break; >>>> ... >>>> if (testN) break; >>>> >>>> more code here >>>> } while (0); >>>> >>>> execution continues from here >>>> >>> >>> This can be even achieved using the switch/case statement.... >>> >>> HND >>> >>> KatolaZ >> >> Switch/case mandates "case constant-expression:" which is far more >> restrictive compared to a series of if statements. 'If' can take ANY >> expression as its control expression. This makes a whole difference in >> its applicability field. I am NOT saying a switch statement is to be >> avoided. In fact, in the source code of simple-netaid-backend, I used >> it. >> >> Edward >> > _______________________________________________ Dng mailing list [email protected] https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
