Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: IF (simple coding problem)
Replies: 4   Last Post: Feb 11, 2013 2:31 PM

 Messages: [ Previous | Next ]
 Chris McCorquodale Posts: 4 Registered: 12/6/12
IF (simple coding problem)
Posted: Feb 11, 2013 9:34 AM

Hi,

I am having troulbe using the IF operator. Logically, what I am doing makes sense but it doesn't give the correct output so obviously somethings going wrong. Trying to keep it simple (so as not to confuse things), when I input:

T=301
if 290<T<300
a=1
else
a=2
end

It always give me a=1?? To me, this code says if T is between 290 and 300 (which it isn't) a=1, any other value and a=2. Why then is it giving me a=1 and how can I rectify this? Is it something to do with the '<' symbols?

Date Subject Author
2/11/13 Chris McCorquodale
2/11/13 dpb
2/11/13 Curious
2/11/13 Chris McCorquodale
2/11/13 Loren Shure