Hey guys,
I'm just starting out with understanding algorithms, but I had a quick question I can't find a direct answer to.
Say you had something that looked like this:
input X
if (0 <= X and <50)
output "Message1"
else if (50 <= X and X <70)
output "Message2"
else if (70 <= X and X <85)
output "Message3"
else if (85 <= X and X <100)
output "Message4"
end if
output "FinalMessage"
Would you get a "FinalMessage" output regardless of what you input you used?
Or would you only get the "FinalMessage" output if of the branches wasn't executed?
Thanks for your help!
n00b Algorithm Question.
Page 1 of 12 Replies - 416 Views - Last Post: 29 June 2012 - 03:39 PM
Replies To: n00b Algorithm Question.
#2
Re: n00b Algorithm Question.
Posted 29 June 2012 - 03:17 PM
If none of the if statements matched your input, you would bet FinalMessage AND if one of your if statements executed, you would also get FinalMessage. You will get FinalMessage no matter what.
#3
Re: n00b Algorithm Question.
Posted 29 June 2012 - 03:39 PM
Alright, that's kind of what I was leaning toward but I just wanted to be sure.
Thanks for your help!
Thanks for your help!
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote






|