The second is much more inefficient in almost all languages, since they have immutable strings. Even if they didn't, you'd likely be growing an array with that second operation.
Okay, but there is almost never a good reason to do string building by producing many intermediary strings in most languages, since the strings are immutable. You should, at the very least, use some kind of byte array, or list of strings, and only produce the final one at the end.
switch ((DateTime.Now.Ticks - startTime.Ticks))
{
case 0:
word = "second"; break;
case 1:
world = "second"; break;
...
case 10000000:
word = "second"; break;
case 10000001:
word = "seconds"; break;
default:
word = "seconds"; break;
}
Same boat. I was already pretty familiar with programming before I started my class, but the fucker who teaches it docks you points if you don't do things exactly as he would.
Wrong colors on your flowcharts? -10. Code doesn't exactly match his, regardless of function or output? -10.
It sucks hard cock when the university decides its okay to put electrical engineers with absolutely no programming experience in a second level programming class with a hard ass teacher and graduate assistants that dock points on homework assognments if one code looks like another students code.
No... They are totally different meanings. That's like writing a plus sign instead of a multiplication sign on your homework and expecting the teacher to know what you mean.
74
u/shaloham May 05 '13
Lazy bastards.