Is There an Easy Way to Convert a Boolean to an Integer?

Posted by Russ Bradberry on Stack Overflow See other posts from Stack Overflow or by Russ Bradberry
Published on 2010-04-13T22:47:47Z Indexed on 2010/04/13 22:53 UTC
Read the original article Hit count: 187

Filed under:
|
|
|

I am new to scala and I am finding the need to convert a boolean value to an integer. I know i can use something like if (x) 0 else 1 but I would like to know if there is a preferred method, or something built into the framework (ie toInt())

© Stack Overflow or respective owner

Related posts about scala

Related posts about integer