kotlin学习笔记1-基础
kotlin学习笔记1-基础

-
优势
enter description here-
基础工具下载
-
命令行工具
- github release
-
eclipse
enter description here- https://www.eclipse.org/
- eclipse安装kotlin插件
- 安装1
enter description here- 安装2
enter description here- 安装3 后自动重启
enter description here- 安装4 安装成功
enter description here
-
idea
- 官网网址
- 三个版本
- Community:
- 社区版,免费,但是功能有限制,AndroidStudio就是基于这个版本定制的。
- http://idea-intellij.com/intellij-community/
- Ultimate:
- 终极版,收费,功能无限制。
- http://idea-intellij.com/intellij-ultimate/
- Community:
-
-
建立第一个kotlin工程
-
增加环境
enter description here
-
新建工程
- 空白处右键
enter description here
-
新建kt文件 右键
-
enter description here -
示例图
enter description here
-
代码如下
fun main(args:Array<String>){ println("HelloWorld"); }
-
-
运行工程 右键运行工程
enter description here
-
含义解释
enter description here
-
快捷键
- 输入main后 alt+\ 自定弹出下面代码
-![enter description here enter description here]()
- 输入main后 alt+\ 自定弹出下面代码
-
-
函数
-
函数的概念
- 计算机里面的函数就是,程序执行的小片段,
- 这些小片段可以有机的组合在一起,完成一个复杂的业务功能
-
Main函数
- main函数是kotlin程序的入口函数,
- 他是计算机运行起来第一个默认找的第一个运行的函数
-
fun main(args:Array<String>){ println("HelloWorld"); } ``` -
println() 函数
- println函数的作用就是打印括号里面内容到控制台
-
交互式编程
配置环境变量
enter description here-
Kotlin函数编写规则
enter description here
示例
enter description here
enter description here-
简易计算器
enter description here- 作业
enter description here-
字符串模版
enter description here























浙公网安备 33010602011771号