Posted: Mon Jun 19, 2006 9:53 pm Post subject: I have a question...
If an if statement containing many elsif parts and no else part
a) Only one of the conditions is allowed to be true; otherwise there is an error.
b) All the actions corresponding to true conditions are selected.
c) Only the first true condition (if any ) is selected.
d) At least one of the conditions is required to be true, otherwise there is a run-time error.
e) None of the above.
Sponsor Sponsor
TheOneTrueGod
Posted: Mon Jun 19, 2006 10:01 pm Post subject: (No subject)
d)
Martin
Posted: Mon Jun 19, 2006 10:17 pm Post subject: (No subject)
No.
The answer is c). Try it out and see
code:
var x := 2
var y := 2
if x = 0 then
put x
elsif x = 1 then
put x
elsif x = 2 then
put x
elsif y = 2
puts "This isn't called!"
end if
Bored
Posted: Tue Jun 20, 2006 7:57 am Post subject: (No subject)
You shouldn't do peoples homework for them. This is obviously either a quiz question or homework question they don't know and are to lazy to check out.
TheOneTrueGod
Posted: Tue Jun 20, 2006 8:01 am Post subject: (No subject)
lol, I know, thats why I gave him the wrong answer... Have more faith in my Turing knowledge
Bored
Posted: Tue Jun 20, 2006 8:02 am Post subject: (No subject)
I knew you did but it was Martin that was aimed at.
upthescale
Posted: Tue Jun 20, 2006 2:39 pm Post subject: (No subject)
Martin wrote:
No.
The answer is c). Try it out and see
code:
puts "This isn't called!"
Seems liek Martin is familiar with Ruby...
aldreneo
Posted: Wed Jun 21, 2006 12:42 pm Post subject: (No subject)
Or perl...Or was that C
AHHH this is what happens when you lean 5 languages at once