Kotlin functions
2019独角兽企业重金招聘Python工程师标准>>>
Kotlin functions
fun hello() {
println("hello world")
}
fun hello(name: String, age: Int) {
println("Hello, $name!")
}
fun hello(name: String = "World") {
println("Hello,$name")
}
fun hasItems(): Boolean {
return true
}
fun cube(x: Double): Double = x * x * x
fun sum(vararg x: Int) {}
fun main1(args: Array<String>) {}
fun main(args: Array<String>) {
openFile("file.txt", readOnly = true)
}
fun openFile(fileName: String, readOnly: Boolean): File {
}
fun createFile(fileName: String, appendDate: Boolean = false, executable: Boolean = false): File {}
fun init() {
val module = createList<String>("net")
val moduleInferred = createList("net")
}
fun <T> createList(item: T): List<T> {}
fun createBook(): Book {
return Book("title_01", "author_01")
}
data class Book(val title: String, val author: String) {
}
转载于:https://my.oschina.net/iioschina/blog/1501574
Kotlin functions相关推荐
- 使用Kotlin的Android SeekBar
In this tutorial, we'll discuss and implement SeekBar in our Android Application using Kotlin. 在本教程中 ...
- kotlin面试_Kotlin面试问题
kotlin面试 Kotlin is the latest JVM programming language from the JetBrains. Google has made it the of ...
- kotlin函数_Kotlin函数
kotlin函数 In this tutorial, we'll be discussing at length, Functions in Kotlin. We'll discuss everyth ...
- kotlin 对话框_使用Kotlin的Android警报对话框
kotlin 对话框 In this tutorial, we'll be discussing Alert Dialogs and implement them in our Android App ...
- 使用Kotlin的Android TextView –全面教程
Kotlin is the official programming language for Android apps development. In this tutorial, we'll be ...
- 使用Kotlin的Android ToggleButton
In this tutorial, we'll learn how to implement Android ToggleButton using Kotlin. We will learn how ...
- Overload resolution ambiguity. All these functions match. kotlin 开发问题日常记录
平时在开发的过程中, 如果我们用定义了一个泛型类,同时定义了两个重载方法,比如: package com.company class ListT<T> {fun add(position: ...
- kotlin中的异常处理_如何使用assertFailsWith在Kotlin中测试异常
kotlin中的异常处理 by Daniel Newton 丹尼尔·牛顿 如何使用assertFailsWith在Kotlin中测试异常 (How to test exceptions in Kotl ...
- kotlin ++ --_顺便说一句-探索Kotlin代表团
kotlin ++ -- by Adam Arold 亚当·阿罗德(Adam Arold) 顺便说一句-探索Kotlin代表团 (By the way - exploring delegation i ...
最新文章
- mysql按条件提取数据库_SQL中的where条件,在数据库中提取与应用浅析
- 【学习笔记】35、定义自己的异常类
- 2更新字段其中一位_NoSQL之MongoDB——数据更新操作
- C++定时器的实现之格式修订版
- linux笔记索引 QQFF-200305
- leetcode力扣49. 字母异位词分组
- 刹车时到底要不要踩离合器?
- python generator转为list_Python中的 List Comprehension 以及 Generator
- hdoj2046骨牌铺方格题解+拓展(递推/斐波那契)
- python3分解质因数_python3 分解质因数
- 点击自定义按钮弹出百度商桥对话框
- hosts文件位置在哪
- 基因芯片(Affymetrix)分析3:获取差异表达基因
- 常用html5阅览器,最好的网页浏览器排行,速度最快的四大浏览器分享
- Linux arm cpu topology
- java 58同城 抓取_前嗅ForeSpider教程:采集58同城
- 【阿里云高校计划】导论-视觉AI技术应用探索 day1 【一见钟情】
- ebs R12下破解apps用户密码
- qq聊天记录的图片怎么看
- redis 缓存 2023面试题总结