Sunday, 13 January 2019

Groovy: intdiv: Perform integer division


‘intdiv’ method return the integer value as result after performing division.

HelloWorld.groovy
a = 10
b = 3

println "a =  ${a}"
println "b = ${b}"

println "a / b = ${a / b}"
println "a % b = ${a.intdiv(b)}"

Output
a =  10
b = 3
a / b = 3.3333333333
a % b = 3

Previous                                                 Next                                                 Home

No comments:

Post a Comment