the tutorial doesnt seem to be helping that much. i dont really understand lesson 5.
any advice?
mabe i just need a break...
the tutorial doesnt seem to be helping that much. i dont really understand lesson 5.
any advice?
mabe i just need a break...
Last edited by NiVaG; 09-24-2004 at 07:45 PM.
do you have any specific questions?
some entropy with that sink? entropysink.com
there are two cardinal sins from which all others spring: Impatience and Laziness. - franz kafka
well ya, but you guys are going to get fed up with me if i ask all my questions about every lesson.
but heres one or a few.
it said that Switch case statements are a substitute for long if statements that compare to an integral value
how does this have anything to do with if statements? and"that compare to an integral value " makes no sence to me.
then it saidCode:switch ( value ) { case this: Code to execute if value == this break; case that: Code to execute if value == that break; ... default: Code to execute if value != this or that break; }
"The condition of a switch statement is a value. The case says that if it has the value of whatever is after that case then do whatever follows the colon"
but in the example theres nothing for it to do....it just repeats itself..
in one of the sample programs i uses the word void yet it doesnt tell you what that word is!
now that i think about it, nothing in lesson 5 makes sence to me so.....
if your wondering what my question is read lesson 5
.
Last edited by NiVaG; 09-24-2004 at 09:09 PM.
switch statements are simply a way to shorten your code. For example, rather than writing:
You can write this:Code:if (x==5) //do something else if (x==6) //do something else else if (x==7) //do something else //etc
Which will probably make the code easier to read and a bit shorter if you have a bunch of values to test against.Code:switch(x) { case 5: //do something break; case 6: //do something else break; case 7: //do something else break; }
"Think not but that I know these things; or think
I know them not: not therefore am I short
Of knowing what I ought."
-John Milton, Paradise Regained (1671)
"Work hard and it might happen."
-XSquared