Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I have Int
val y = 10
I want to cast to BigInt
y.toBigInt
it show error
<console>:26: error: value toBigInt is not a member of Int y.toBigInt
How can I cast Int to BigInt ?
val d :BigInt = 10
Here is example:
val i: Int = 1 val bigInt = BigInt(i)
Add a comment
All the obvious methods work. You can assign an Int to a BigInt, you can pass an Int to a function that takes BigInt, and you can just use BigInt(y).
Int
BigInt
BigInt(y)
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
val d :BigInt = 10