Talk:Switch statement
| This is the talk page for discussing improvements to the Switch statement article. This is not a forum for general discussion of the subject of the article. |
Article policies
|
| Find sources: Google (books · news · scholar · free images · WP refs) · FENS · JSTOR · TWL |
| This article is rated C-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | |||||||||||
| |||||||||||
I don't think 2 is...
I don't think 2 is a 'perfect square' as the bash code suggests it is. Could somebody maybe fix this? —Preceding unsigned comment added by 207.65.110.71 (talk) 02:04, 5 June 2009 (UTC)
- Fixed. Rich Farmbrough, 23:59, 13 December 2009 (UTC).
Visual FoxPro
Is there a typo in the third case statement in the given example? —Preceding unsigned comment added by 206.174.71.149 (talk) 06:24, 3 January 2010 (UTC)
Simplify the examples? A reader's suggestions (removed from article and placed here)
Suggestion from 86.186.234.3:
"Note: The following examples make it difficult to evaluate the methods of each language since the examples across languages are not alike. If somebody were to re-write the example so they all achieved the same thing, it would be very helpful. Using the 'switch' construct in a program which displays the verses to "The twelve days of Christmas" makes for a Very good example of how switch can be used."
--- I have no opinion about this, myself... BillWvbailey (talk) 17:44, 3 January 2011 (UTC)
Wrong C program.
The program in C is technically correct in terms of conditional statements, but I'm sure it's not "puts," it's at least "print". —Preceding unsigned comment added by Clammybells (talk • contribs) 01:07, 21 May 2011 (UTC)
- No idea what you refer to. Stevebroshar (talk) 12:36, 5 September 2025 (UTC)
Compilation section example
The compilation section mentions "The first 'C' example below", but most examples have been removed from the page for whatever reason, so this no longer makes sense. Perhaps the old C example should be added into this section? --Rabbitkillrun (talk) 19:08, 25 May 2013 (UTC)
- I have no idea what this code is that's been removed. You do, I guess. Don't expect me to go looking for it. Just add it back if you think it's worthwhile. But... in general there are far too many example in WP. Less is more. This is not a programming guide. Stevebroshar (talk) 12:36, 5 September 2025 (UTC)
"case x ... y" statement in C
In C you can also use "case" like this:
char c = 'X';
switch (c)
{
case 'A' ... 'Z':
printf("%c == upper letter\n", c);
break;
case 'a' ... 'z':
printf("%c == lower letter\n", c);
break;
case '0' ... '9':
printf("%c == digit\n", c);
break;
default:
printf("%c == something else\n", c);
break;
}
I haven't seen this before, it might be worth mentioning it. 2A02:908:1463:E7A0:2D1A:AD69:9EA8:B3BE (talk) 20:32, 4 December 2020 (UTC)
- Well... WP is not a guide for how to program in C or any language. Maybe there's a place for this in the article, but it should be relatively limited/small if at all. Stevebroshar (talk) 12:34, 5 September 2025 (UTC)
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.