Page 1 of 1

Problem with operator "is an integer"

Posted: Thu Mar 20, 2014 6:54 pm
by Daross
Hi all,
I created this function which return if the number is true or false

Code: Select all

function theInteger pNumber
   return pNumber is an integer
end theInteger
What I do not understand why it is not a false return false

Code: Select all

put theInteger(8.4/1.2) --> return false!
  
I created a stack to explain better the problem (the script is in the button)
Thanks in advance

Re: Problem with operator "is an integer"

Posted: Thu Mar 20, 2014 7:03 pm
by Klaus
HI Daross,

you are supplying an expression and not a "simple" number in the parameter! 8)

But you can force LC to evaluate that one before checking for integer, just use VALUE:

Code: Select all

function theInteger pNumber
   return VALUE(pNumber) is an integer
end theInteger
Tested and works!


Best

Klaus

Re: Problem with operator "is an integer"

Posted: Thu Mar 20, 2014 7:13 pm
by Daross
Hey Klaus thanks for the trick!
Works well! :D