Q:

TI-84 Set Variable Based on Boolean Expression

For a ti-84 program I used the quadratic equation and stored the root with the plus sign as N and the root with the negative sign as R. I then want to only use the positive root as the value for the rest of the program (if both are positive it doesn't matter I just want to check one is positive), so I did as follows:
If N>0 --> U

ElseR-->U

But it didn't work. Is it not possible to use store as a command in an if-else statement? Or is there another way to only choose the positive variable and store that as U?

A:

Okay, listen. Blazo's answer is wrong. Every If statement that has an Else also needs a Then and an End. This is the correct way to write it without piecewise expressions (piecewise expressions are usually the best way to go, though, so I suggest you check out dohaqatar's answer as well):
If N>0
Then
N->U
Else
R->U
End

With two separate lone If's, you can reduce the size of the code by one byte to 17 bytes:
If N>0
N->U
If N<=0
R->U

You can compress it even more, saving 5 more bytes to make 12 bytes:
R->U
If N>0
N->U

You can also use a piecewise expression such as dohaqatar's below, also 12 bytes:
N<0:RAns+Nnot(Ans->U

The best part is, an algorithm change reduces code size to 6 bytes:
max(R,N->U

