Loading ...
Sorry, an error occurred while loading the content.

186Re: Expected a 'break' statement before 'case'

Expand Messages
  • Douglas Crockford
    Aug 20, 2008
    • 0 Attachment
      --- In jslint_com@yahoogroups.com, "Fred Lorrain" <yahoo@...> wrote:
      > I know that break is recommended before a case but it's not mandatory.
      > In the following example there is nothing wrong, right?
      >
      > switch (this.layout) {
      > case 'calendarmonth2':
      > ...
      > this.generateMonth = this.generateMonth_finonline;
      > case 'calendarmonth':
      > this.drawMonthTabs();
      > break;
      > case 'calendarteaser':
      > ...
      > break;
      > default:
      > ...
      > }
      >
      > Omitting the break before calendarmonth is done on purpose.
      > Isn't it the right way to do it?
      >
      > Maybe the word Warning should be used instead of problem.
      >
      > Warning at line 732 character 66: Expected a 'break' statement before
      > 'case'.
      >
      > Instead of
      >
      > Problem at line 732 character 66: Expected a 'break' statement before
      > 'case'.

      I thought you were supposed to be the too strict, too maniac guy.

      See http://yuiblog.com/blog/2007/04/25/id-rather-switch-than-fight/
    • Show all 3 messages in this topic