- Kotlin Standard Library Cookbook
- Samuel Urbanowicz
- 63字
- 2021-07-23 19:05:49
How to do it...
- Let's create a variable and assign to it a random integer value:
val randomInt = Random().nextInt()
- Now we can check whether the randomInt value belongs to the scope of integers from 0 to 10 inclusive using range expressions:
if (randomInt in 0..10) {
print("$randomInt belongs to <0, 10> range")
} else {
print("$randomInt doesn't belong to <0, 10> range")
}
推薦閱讀
- Cocos2d Cross-Platform Game Development Cookbook(Second Edition)
- 軟件項(xiàng)目管理(第2版)
- 數(shù)據(jù)結(jié)構(gòu)習(xí)題精解(C語言實(shí)現(xiàn)+微課視頻)
- 深入理解Java7:核心技術(shù)與最佳實(shí)踐
- Mastering Ext JS
- 大模型RAG實(shí)戰(zhàn):RAG原理、應(yīng)用與系統(tǒng)構(gòu)建
- 零基礎(chǔ)學(xué)Python網(wǎng)絡(luò)爬蟲案例實(shí)戰(zhàn)全流程詳解(入門與提高篇)
- C#應(yīng)用程序設(shè)計教程
- Visualforce Developer’s guide
- Building Serverless Architectures
- 深入實(shí)踐Kotlin元編程
- FFmpeg開發(fā)實(shí)戰(zhàn):從零基礎(chǔ)到短視頻上線
- Android Development Tools for Eclipse
- Mastering Concurrency Programming with Java 9(Second Edition)
- 數(shù)據(jù)分析與挖掘算法:Python實(shí)戰(zhàn)