Directory Introduction website and document Chinese Community Tutorials Articles Open Source Library and framework Demo Other introduction Why do this. On Google I/O this morning, Google officially announced official support for Kotlin. In order to let everyone faster understanding and hands-on Kotlin, here for everyone to tidy up this kotlin resources, hope can
printSum(a: Int, b: Int) { a3. Main functionArrayString{}4. If condition statementmax(a: Int, b: Int): Int { if(a>b) returna else return b}Simplified notationmax(aif (aaelse b5. Use nullable variables and null values to checkSwift has a type of optionalKotlin also has this type of operationparseIntString): Int?{}It is possible for the function to return an int and possibly return nullSo null judgment is required for useArrayString>) { parseInt(args[0]) pa
implemented by using functions as parameters, some cannot be called syntax, but functions are nested, infix function call,lambda, function parameters, variable argument lists, flexible tags, powerful return, automatic type judgments, Range,iterator, operator overloading, omitting, template ... These are too many features that cause Kotlin's syntax to dazzle, though sometimes it may seem elegant, but it can also cause great difficulty in reading the code.End this article with a piece of code wit
Data Class
The data class is a special class in Kotlin, and its particularity is shown in the following aspects:
The primary constructor of the data class requires at least one parameter;
All parameters of the main constructor must be decorated with Val or var;
The data class cannot be abstract, open, sealed, or internal, meaning that the data class can only be final;
Before Kotlin 1.1, the data class coul
Kotlin is 100% interoperable with Java™and android™
In the previous chapters, we've learned about Kotlin's basic syntax, type systems, generics and collection classes, object-oriented and functional programming, and in the previous chapter we saw the lightweight concurrency programming model provided by Kotlin: the related content of the coprocessor.
From the beginning of this chapter to the later chapters,
Kotlin (1) Build the Kotlin development environment and kotlin
As a programming language, Kotlin has been around for several years, but it is not well-known in China. Since Google announced it as the official Android development language in May, Kotlin has suddenly become po
language, but Koltin is perfect for me as a common-code farmer. My request is not high, give mouth rice to eat on the line, know? Scala is good, but it's too good to be true, like a bullfrog's brain truffle snail. To know that I am a blue collar, Clojure, Scala language is too big for me.It took me about 3 days to learn the grammar of Kotlin, and then I began to formally program it, although I was still ve
language itself.Why is Kotlin used?
If a programming language is not enough to change your programming thinking, it fails. We are familiar with static languages such as C, Obj-C, and JAVA. It is time to learn dynamic languages such as Swift, Go, and Kotlin.The second reason is that Kotlin can indeed omit a lot of coding and its unique language features.The third
In this article we will learn the basic syntax and common operation Basic types of Kotlin by analogy with Java syntax
Java
Kotlin
bit width
Double
Double
64
Float
Float
32
Long
Long
64
Int
Int
32
Short
Short
16
Byte
Byte
the subjective perspective of this problem, I would like to see this phenomenon happen. The reason is not because I prefer kotlin, but because I prefer to see things progressing and becoming excellent, so even if one day Kotlin be replaced by a better language, I am very welcome.Who is right for the first application KotlinKotlin is suitable for multiple platforms and does not restrict learners. Anyone wit
installing the Kotlin plugin into Android Studio and creating your first Kotlin application.
For more in-depth introduction, please check the site's reference documents and Kotlin heart print.
Another good resource is Kotlin for Android developers, which guides you through the process of creating a real Androi
prefer kotlin, but because I prefer to see things progressing and becoming excellent, so even if one day Kotlin be replaced by a better language, I am very welcome.Who is right for the first application KotlinKotlin is suitable for multiple platforms and does not restrict learners. Anyone with a willingness to learn can acquire the language.However, considering
Kotlin series: extended functions and attributes, and kotlin series extended functions
Extended functions and attributes can be added based on existing classes, but these functions and attributes are defined outside the class. Are you curious? Let's take a look.Extended Functions
Let's use an example to analyze and add a member function to the String class.LastChar, used to obtain the last character of a s
Now I am using Kotlin to develop Android for 12 reasons (KAD 30) and kotlinandroid
By Antonio Leiva
Time: Jul, 11,201 7
Link: https://antonioleiva.com/reasons-kotlin-android/
This group of articles has reached the end, and they are very practical. Today I want to talk about why I think it is very interesting to learn Kotli
understand, come and tell me, see I do not kill you!! Hem ~ ~ ~Androidstudio 3.0 automatically adapt to the Kotlin, of course, now you can install plug-ins, or directly with INTELLJ, this we say, we can put all of our project's Java files directly into the Kotlin file, finally Kotlin has an advantage, No semicolon!! No semicolon!! No semicolon!! The important th
follows:
public class YetAnotherActivity : Activity() { private var a: Int = 0 private var b: Int = 0 override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) a = 10 b = 20 Log.d("MESSAGE", "The sum is " + (a + b)) }}
In addition to file content changes, the file extension also changes from. java to. kt.Summary
In this article, we learned how to use Kotlin In the Android project b
Kotlin data class: saves a lot of lines of code (KAD 10) and kotlin many lines
By Antonio Leiva
Time: Jan 25,201 7
Link: https://antonioleiva.com/data-classes-kotlin/
In the previous article, we have seen classes, and data classes can further help us simplify code.
What is a data class?
DataIs an action that only contains the status and does not have any exec
Elimination of function overloading in the Kotlin series and kotlin function Overloading
I. Problems Caused by function Overloading
1. Problems Encountered
Whether in Java or C ++, function Overloading is used to expose interfaces with different parameters, including the number of parameter lists and parameter types, to meet service requirements of different functions, parameter order. However, different
Google Android Studio Kotlin Development environment ConfigurationGoogle's recent developer conference announced that Kotlin become the first language of Android development, that is, the official Android language development, it can be seen that Google Kotlin attention, this article describes the Android Kotlin Develo
KOTLIN development language documentation (official documentation), kotlin development language
Web link: https://kotlinlang.org/docs/reference/basic-types.html2. Basic Concepts 2.1. Basic Types
From the perspective of Calling member functions and attributes in any variable processing, everything in the Kotlin development language is an object. Some types are emb
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.