当前位置:网站首页>Kotlin keyword and operator
Kotlin keyword and operator
2022-06-25 09:52:00 【seevc】
And Java contrast , take kotlin Unique keywords come first .
Hard keywords
keyword | meaning |
---|---|
val | Declare a read-only variable |
var | Declare a variable |
when | Start a when expression , similar Java Medium switch |
as | For type conversion ; Specify an alias for the import |
as? | Used for safe type conversion |
fun | Declare a function |
in | 1. Appoint for Objects iterated in the loop ;2. As infix operator , Detect the interval of a value ;3. Mark a type parameter as inverse |
!in | 1. Use as infix expression , Detect that a value does not belong to an interval |
is | Detect that a variable is of a specified type |
!is | Detect that a variable is not of the specified type |
typealias | Declare a type alias |
interface | Declare an interface |
break | Terminate the execution of the loop |
class | Declare a class |
continue | Continue to the next cycle |
do | Post conditional loop ,do/while Use a combination of |
else | A definition of if The branch taken when the expression does not satisfy the condition |
false | Boolean type “ false ” value |
for | Start a for loop |
if | Start a if expression |
null | Is a constant that represents an object reference that does not point to any object |
object | Declare a class and its instances at the same time , |
package | Specifies the package of the current file |
return | Return from the nearest layer function or anonymous function |
super | Methods that reference the parent class ; The constructor of the parent class is called in the constructor |
this | 1. Reference the current recipient ;2. Call another constructor in the constructor |
throw | Throw an exception |
try | Start an exception handling block |
while | Start a while loop |
Soft keywords
The following symbols act as keywords in the applicable context , It can be used as an identifier in other contexts :
keyword | meaning |
---|---|
by | agent , Delegate the implementation of the interface to another object ; Delegate the implementation of the property accessor to another object |
constructor | Declare a constructor , When there are multiple constructors, you will use |
delegate | Used as the target of annotation |
dynamic | Refer to a Kotlin/JS Dynamic types in code |
init | Start an initialization code block |
where | Specify constraints for generic type parameters |
field | Use in comments |
file | Used as an annotation |
finally | try A block that is always executed when a statement block exits |
get | 1. Declaring the property getter;2. Use in comments |
set | 1. Declaring the property setter;2. Use in comments |
import | Import the declaration from another package into the current file |
边栏推荐
- 2022 meisai question a idea sharing
- SQL advanced
- (forwarding articles) after skipping multiple pages, shuttle returns to the first page and passes parameters
- Simple waterfall effect
- What are the PMP scores?
- [buuctf.reverse] 121-125
- 汇付国际为跨境电商赋能:做合规的跨境支付平台!
- 链表 删除链表中的节点
- Huipay international permet au commerce électronique transfrontalier de devenir une plate - forme de paiement transfrontalière conforme!
- Question B of the East China Cup: how to establish a population immune barrier against novel coronavirus?
猜你喜欢
Ruiji takeout project (II)
Japanese online notes for postgraduate entrance examination (9): composition template
CyCa children's physical etiquette Yueqing City training results assessment successfully concluded
Remove the mosaic, there's a way, attached with the running tutorial
Simple waterfall effect
Unique Wulin, architecture selection manual (including PDF)
Pytorch_ Geometric (pyg) uses dataloader to report an error runtimeerror: sizes of tenants must match except in dimension 0
manhattan_ Slam environment configuration
Wearable devices may reveal personal privacy
Data-driven anomaly detection and early warning of 21 May Day C
随机推荐
CYCA 2022少儿形体礼仪初级师资班 深圳总部站圆满结束
Oracle function trigger
Where is safe for FTSE A50 to open an account
[shared farm] smart agriculture applet, customized development and secondary development of Kaiyuan source code, which is more appropriate?
PHP obtains the IP address, and the apache2 server runs without error
Grabcut image segmentation in opencv
[competition - Rural Revitalization] experience sharing of Zhejiang Rural Revitalization creative competition
How do dating applets make millions a year? What is the profit model?
Exception: gradle task assemblydebug failed with exit code 1
Use evo
With the QQ group file storage function of super nice, you immediately have n cloud disks that are easy to download and never expire
Download the arm64 package of Debian on X86 computer
Flutter Gaode map privacy compliance error
Online notes on Mathematics for postgraduate entrance examination (9): a series of courses on probability theory and mathematical statistics
The problem of automatic page refresh after the flyer WebView pops up the soft keyboard
【mysql学习笔记21】存储引擎
Is it safe to open an account with Great Wall Securities by mobile phone?
Japanese online notes for postgraduate entrance examination (9): composition template
Is it safe for Huatai Securities to open an account on it? Is it reliable?
Creo makes a mobius belt in the simplest way