Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Changing Feels Like Values?

Discussion of Ken True's web site templates

Moderator: saratogaWX

User avatar
mcrossley
Posts: 12756
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Changing Feels Like Values?

Post by mcrossley »

The 'default' is just another case block, so like any other it may or may not have a break; statement. The switch will terminate the final case block at the switch close if there is no break present.
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Changing Feels Like Values?

Post by William Grimsley »

Oh, right! That's a very interesting fact, Mark! I never knew that! LOL :D
BCJKiwi
Posts: 1255
Joined: Mon 09 Jul 2012 8:40 pm
Weather Station: Davis VP2 Cabled
Operating System: Windows 10 Pro
Location: Auckland, New Zealand
Contact:

Re: Changing Feels Like Values?

Post by BCJKiwi »

Well yes it is another item in the switch structure but
"default:" surely has a different meaning to "case x:"
- i.e. isn't default already the terminator of the switch statement - no break required?

(sorry just being pedantic here - ignore me if you wish ;) )
User avatar
steve
Cumulus Author
Posts: 26701
Joined: Mon 02 Jun 2008 6:49 pm
Weather Station: None
Operating System: None
Location: Vienne, France
Contact:

Re: Changing Feels Like Values?

Post by steve »

It's not required, but it's optional, just as it is with any of the other branches. If the 'default' is the last branch, the break has no effect, just as it would have no effect on the last 'case' if there were no 'default'. The 'default' branch doesn't have to be the last one; by convention it usually is.

The 'break' isn't actually anything to do with the switch statement, it's just the normal 'break' statement which says 'terminate this code block', so it's just part of the statements to be executed in the branch.
Steve
User avatar
mcrossley
Posts: 12756
Joined: Thu 07 Jan 2010 9:44 pm
Weather Station: Davis VP2/WLL
Operating System: Bullseye Lite rPi
Location: Wilmslow, Cheshire, UK
Contact:

Re: Changing Feels Like Values?

Post by mcrossley »

steve wrote:The 'break' isn't actually anything to do with the switch statement, it's just the normal 'break' statement which says 'terminate this code block', so it's just part of the statements to be executed in the branch.
and some might argue that it should really have been made implicit before the next case statement, and that to fall through you would have to explicitly 'continue'.
Post Reply