Wednesday, September 9, 2015

Modulo Operator in Structured Text

 If you are reading this post, I am sure that you have other programming language background and have to fire the %  operator in your IF ELSE condition.
 But rather the equivalent operator for structured text you should use is MOD operator.
So instead of writing
 IF ( ( myVar % 10 ) == 0 ) THEN

 You should

IF ( ( myVar MOD 10 ) = 0 ) THEN

I hope that you are going to continue peaceful your journey to your project in automation.

Happy coding day !!

 

No comments:

Post a Comment