Posted: Wed Dec 15, 2004 7:06 pm Post subject: 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?
Sponsor Sponsor
SuperGenius
Posted: Wed Dec 15, 2004 8:01 pm Post subject: (No subject)
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:
code:
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
Posted: Wed Dec 15, 2004 11:54 pm Post subject: (No subject)
SuperGenius wrote:
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:
code:
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:
code:
case input of
label 1: proca()
label 2: procb()
label 3: procc()
label: procd()
end case
Kelsey
Posted: Thu Dec 16, 2004 12:02 am Post subject: (No subject)
Thank-you both, I guess I'll have to clarify with my teacher.
SuperGenius
Posted: Thu Dec 16, 2004 4:25 pm Post subject: (No subject)
wtd wrote:
More likely the construct in question is:
code:
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
Posted: Thu Dec 16, 2004 4:45 pm Post subject: (No subject)
SuperGenius wrote:
wtd wrote:
More likely the construct in question is:
code:
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.