JeffB Posted August 26, 2022 Share Posted August 26, 2022 Will the code below work such that even_number is false if count is odd, true if count is even? Any issue with count actually being a floating point number instead of an integer? Seems not working in the field (count is always 0) but I don't have the hardware at hand to test. global count global even_number count = 2; if ((count & $1) == 0) even_number = 1 else even_number = 0 Quote Link to comment Share on other sites More sharing options...
steve.milici Posted August 26, 2022 Share Posted August 26, 2022 This works as you expect on my ARM CPU (FW vs 2.6.1.0). Try adding “curly” braces: if ((count & $1) == 0) {even_number = 1} else {even_number = 0} Or multiline: if ((count & $1) == 0) even_number = 1 else even_number = 0 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.