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相关推荐

  1. 使用Kotlin的Android SeekBar

    In this tutorial, we'll discuss and implement SeekBar in our Android Application using Kotlin. 在本教程中 ...

  2. kotlin面试_Kotlin面试问题

    kotlin面试 Kotlin is the latest JVM programming language from the JetBrains. Google has made it the of ...

  3. kotlin函数_Kotlin函数

    kotlin函数 In this tutorial, we'll be discussing at length, Functions in Kotlin. We'll discuss everyth ...

  4. kotlin 对话框_使用Kotlin的Android警报对话框

    kotlin 对话框 In this tutorial, we'll be discussing Alert Dialogs and implement them in our Android App ...

  5. 使用Kotlin的Android TextView –全面教程

    Kotlin is the official programming language for Android apps development. In this tutorial, we'll be ...

  6. 使用Kotlin的Android ToggleButton

    In this tutorial, we'll learn how to implement Android ToggleButton using Kotlin. We will learn how ...

  7. Overload resolution ambiguity. All these functions match. kotlin 开发问题日常记录

    平时在开发的过程中, 如果我们用定义了一个泛型类,同时定义了两个重载方法,比如: package com.company class ListT<T> {fun add(position: ...

  8. kotlin中的异常处理_如何使用assertFailsWith在Kotlin中测试异常

    kotlin中的异常处理 by Daniel Newton 丹尼尔·牛顿 如何使用assertFailsWith在Kotlin中测试异常 (How to test exceptions in Kotl ...

  9. kotlin ++ --_顺便说一句-探索Kotlin代表团

    kotlin ++ -- by Adam Arold 亚当·阿罗德(Adam Arold) 顺便说一句-探索Kotlin代表团 (By the way - exploring delegation i ...

最新文章

  1. mysql按条件提取数据库_SQL中的where条件,在数据库中提取与应用浅析
  2. 【学习笔记】35、定义自己的异常类
  3. 2更新字段其中一位_NoSQL之MongoDB——数据更新操作
  4. C++定时器的实现之格式修订版
  5. linux笔记索引 QQFF-200305
  6. leetcode力扣49. 字母异位词分组
  7. 刹车时到底要不要踩离合器?
  8. python generator转为list_Python中的 List Comprehension 以及 Generator
  9. hdoj2046骨牌铺方格题解+拓展(递推/斐波那契)
  10. python3分解质因数_python3 分解质因数
  11. 点击自定义按钮弹出百度商桥对话框
  12. hosts文件位置在哪
  13. 基因芯片(Affymetrix)分析3:获取差异表达基因
  14. 常用html5阅览器,最好的网页浏览器排行,速度最快的四大浏览器分享
  15. Linux arm cpu topology
  16. java 58同城 抓取_前嗅ForeSpider教程:采集58同城
  17. 【阿里云高校计划】导论-视觉AI技术应用探索 day1 【一见钟情】
  18. ebs R12下破解apps用户密码
  19. qq聊天记录的图片怎么看
  20. redis 缓存 2023面试题总结

热门文章

  1. 如何结合因果与强化学习?看最新《因果强化学习:动机,概念,挑战与应用》报告,85页ppt...
  2. 未来十年有望改变世界的五大发现
  3. Science子刊带来新遗传证据:早期人类驯化了自己
  4. 一文尽揽2018 Google I/O:谷歌让你感受到AI科技的魅力
  5. 信息技术守护人类文明DNA
  6. 新型量子计算机首个基本元件问世,扩展性更强运算速度更快
  7. 太 6 了!区块链包包、疫情防控大脑……程序员这样玩转区块链!
  8. AliOS Things lorawanapp应用介绍
  9. Pthon JSON
  10. linux之文件的高级命令