
-----------------------------------
Sehroz
Sat Nov 03, 2007 2:38 pm

Help switch statemnts??
-----------------------------------
Heyyy i have this project and i have to use " Switch statements" can anybody tell me wat tthat is??and how i use it ?? thanks greatly aprecaited XD

-----------------------------------
CodeMonkey2000
Sat Nov 03, 2007 2:41 pm

RE:Help switch statemnts??
-----------------------------------
You mean case construct?

-----------------------------------
Sehroz
Sat Nov 03, 2007 2:43 pm

Re: Help switch statemnts??
-----------------------------------
yea its like i have the score for my game then i have to display a msg if the score is 25 or higher, 20 or higher etc and he said to use switch statments to give the user a qualitative message  bases on hte users final score.

-----------------------------------
CodeMonkey2000
Sat Nov 03, 2007 2:47 pm

Re: Help switch statemnts??
-----------------------------------
Straight out of the turing help file:
case selection statement 

Syntax   A caseStatement is:
  case expn of 
    { label compileTimeExpn {, compileTimeExpn } : 
      statementsAndDeclarations } 
    

-----------------------------------
Sehroz
Sat Nov 03, 2007 2:50 pm

Re: Help switch statemnts??
-----------------------------------
thankss but im a noob i dont understand wats the first sentece like to declare it like at the begging its var somthing : int etc?...

-----------------------------------
CodeMonkey2000
Sat Nov 03, 2007 3:11 pm

Re: Help switch statemnts??
-----------------------------------
Consider this example:
var input : string
get input

case input of %looks at the value of input

    label "foo" : %if the value of input is foo then...
        put "You said Foo!"
    label "bar", "Bar" : %if the value of input is bar or Bar then...
        put "you said Bar!"
    label : %if none of the above cases are true then...
        put "I don't understand"
end case


-----------------------------------
Sehroz
Sat Nov 03, 2007 8:05 pm

Re: Help switch statemnts??
-----------------------------------
thankss :) :D  it worked!!
