ksk051182 Posted May 28, 2016 Report Share Posted May 28, 2016 I'm trying to compare 3 integers and pick the highest number. The result is 20 instead of 29 when I run the script below. What am I doing wrong? Variable Set Integer %N1% to 20 Variable Set Integer %N2% to 29 Variable Set Integer %N3% to 15 If variable %N1% <= variable %N2% Switch (N2) End Switch Variable Modify Integer : Copy %N2% to %N10% End IF If variable %N2% <= variable %N3% Switch (N3) End Switch Variable Modify Integer : Copy %N3% to %N10% End IF If variable %N3% <= variable %N1% Switch (N1) End Switch Variable Modify Integer : Copy %N1% to %N10% End IF Text Box Display: end Quote Link to comment Share on other sites More sharing options...
rberq Posted May 28, 2016 Report Share Posted May 28, 2016 Your last IF block gets executed every time, and since 15 is always less than 20 you will always end up with 20 in %N10%.How about this:Variable Modify Integer : Copy %N1% to %N10%If variable %N2% > variable %N10% Variable Modify Integer : Copy %N2% to %N10%End IFIf variable %N3% > variable %N10% Variable Modify Integer : Copy %N3% to %N10%End IFI'm not familiar with using SWITCH without CASE, so I don't know what you have in mind with the SWITCH statements. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.