
-----------------------------------
Kelsey
Wed Dec 15, 2004 7:06 pm

Selection Construct
-----------------------------------
I'm doing a worksheet for class, and my teacher has *forgotten* (yet again) to explain things to us. I am wondering what a selection construct is, and how do i use it?

-----------------------------------
SuperGenius
Wed Dec 15, 2004 8:01 pm


-----------------------------------
I've never heard of one but it sounds to me like an if structure which will take a certain action based on what input it gets. ex:

if input = 1 then
     proca()
elsif input = 2 then
     procb()
elsif input = 3 then
     procc()
else
     procd()
end if


this code would run a procedure called proca if the variable input has a value of one, and so one. If input is not equal to 1,2 or 3 then it will call procd

-----------------------------------
wtd
Wed Dec 15, 2004 11:54 pm


-----------------------------------
I've never heard of one but it sounds to me like an if structure which will take a certain action based on what input it gets. ex:

if input = 1 then
     proca()
elsif input = 2 then
     procb()
elsif input = 3 then
     procc()
else
     procd()
end if


this code would run a procedure called proca if the variable input has a value of one, and so one. If input is not equal to 1,2 or 3 then it will call procd

More likely the construct in question is:

case input of
   label 1: proca()
   label 2: procb()
   label 3: procc()
   label: procd()
end case

-----------------------------------
Kelsey
Thu Dec 16, 2004 12:02 am


-----------------------------------
Thank-you both, I guess I'll have to clarify with my teacher.

-----------------------------------
SuperGenius
Thu Dec 16, 2004 4:25 pm


-----------------------------------

More likely the construct in question is:

case input of
   label 1: proca()
   label 2: procb()
   label 3: procc()
   label: procd()
end case

hmph. I feel cheated out of an education because of all of the things that I never learned.

-----------------------------------
wtd
Thu Dec 16, 2004 4:45 pm


-----------------------------------

More likely the construct in question is:

case input of
   label 1: proca()
   label 2: procb()
   label 3: procc()
   label: procd()
end case

hmph. I feel cheated out of an education because of all of the things that I never learned.

The key is never to leave a classroom feeling like you've learned everything there is to learn.  If you never go beyond what your professor tells you, then there was no point in taking the class.  Any job you'll be able to do, your professor could have done, and faster and better at that.

Use Google.  Use usenet and the vast number of comp.lang.* newsgroups.  There are lots of resources out there just waiting for someone to use them to expand their knowledge.
