官术网_书友最值得收藏!

How it works...

We can see the divide() function in action:

val dividend = 10
val divisor = 3
val (quotient, remainder) = divide(dividend, divisor)

print("$dividend / $divisor = $quotient r $remainder")

The preceding code is going to print the following output:

10 / 3 = 3 r 1

Thanks to the fact that we are returning a data class instance, the DivisionResult class, we can benefit from the destructuring feature and assign the result to a set of separate variables.

主站蜘蛛池模板: 新疆| 卢湾区| 炉霍县| 开封市| 澄城县| 阿拉善左旗| 历史| 顺昌县| 奉新县| 通城县| 丹江口市| 团风县| 囊谦县| 新营市| 漾濞| 玉屏| 仁化县| 霍邱县| 辽阳市| 诸城市| 金坛市| 墨玉县| 宝丰县| 奈曼旗| 林周县| 全南县| 滦平县| 芒康县| 洛南县| 个旧市| 霍邱县| 罗平县| 奉化市| 当雄县| 湖州市| 山阳县| 多伦县| 新安县| 遵义县| 新巴尔虎右旗| 彰化县|