Timeline for answer to Why can't I have a variable in switch-case statement? by user3080666
Current License: CC BY-SA 3.0
Post Revisions
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 2, 2015 at 12:16 | comment | added | HelloGoodbye | @EralpB It is neat because it consists of less code which in my opinion 1) makes reading the code go faster, and 2) makes writing and maintaining the code less error-prone since you need to make changes to fewer places. | |
| Dec 2, 2015 at 12:10 | comment | added | HelloGoodbye | @neckTwi I don't think those extra operations matter, considering that a keypress doesn't happen very often. (Then it is also possible that the compiler might optimize that line to something that is equivalent to the switch–case statement above, although I don't know how much you can trust that it actually does) | |
| Sep 16, 2015 at 11:06 | comment | added | Necktwi | doesn't it increase time complexity? 4 comparisons, 4 type casts and 2 arthmatic ops are to be made with ur single line! | |
| Apr 26, 2015 at 9:46 | history | edited | Peter Mortensen | CC BY-SA 3.0 |
More affirmative answer (Stack Overflow is not a forum - see e.g. http://meta.stackexchange.com/a/92115). Reformatted the sample code, etc.
|
| Apr 19, 2015 at 15:30 | comment | added | slashmais | It is a neat line - maybe you should just add a small explanatory comment to the code to assist the hard-of-reading types ;) | |
| Oct 19, 2014 at 13:41 | comment | added | EralpB | What makes you think that that code is neat? | |
| S Dec 8, 2013 at 20:17 | review | Late answers | |||
| Dec 8, 2013 at 20:18 | |||||
| S Dec 8, 2013 at 20:17 | review | First posts | |||
| Dec 8, 2013 at 20:19 | |||||
| Dec 8, 2013 at 19:59 | history | answered | user3080666 | CC BY-SA 3.0 |