前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Kotlin 语言中的“关键字” Keywords in Kotlin修饰符关键字

Kotlin 语言中的“关键字” Keywords in Kotlin修饰符关键字

作者头像
一个会写诗的程序员
发布2018-12-06 11:28:10
7400
发布2018-12-06 11:28:10
举报

image.png

关键字是预定义的保留字, 在语言中具有特殊含义。 不能将其用作标识符。

但在 kotlin, 有一些关键字在某些情况下可以用作标识符。 在 kotlin 中基本上有四种类型的关键字:

1.硬关键字 2.软关键字 3.修饰符关键字 4.特殊标识符

Keywords are predefined, reserved words that have special meaning in the language. Generally it is recommended to do not use it as identifiers. But in kotlin there are some keywords which can be used as identifiers in some situations. There are basically four types of keywords in kotlin: Hard keywords Soft keywords Modifier keyword Special identifiers

硬关键字

在 kotlin 有24个硬关键字, 在任何情况下都不能用作标识符。 下面是硬关键字的列表。

Hard Keywords There are 24 hard keywords in kotlin which cannot be used as identifiers in any situation. Below is the list of hard keywords.

image.png

软关键字

在Kotlin 中有17个软关键字。 这些标记在特定上下文中充当关键字, 但您可以在其他上下文中将其用作标识符。 下面是软关键字的列表。

Soft Keywords

There are 17 soft keywords in kotlin. These tokens acts as a keyword in certain context, but you can use them as identifiers in other context. Below is a list of soft keywords.

image.png

修饰符关键字

在 Kotlin 中有29个修饰语关键字。 这些标记充当声明修饰者列表中的关键字, 并可在其他上下文中用作标识符。 下面是修饰符关键字的列表。

Modifier Keywords

There are 29 modifier keywords in kotlin. These tokens acts as keywords in modifier lists of declaration and can be used as identifiers in other context. Below is a list of modifier keywords.

image.png

特殊标识符

以下两个特殊标识符由编译器在特定上下文中定义, 可用作其他上下文中的常规标识符。 下面是这两个标识符的列表。

Special Identifier

Following two special identifiers are defined by the compiler in specific context and can be used as regular identifiers in other context. Below are list of that two identifier.

请避免将它们用作标识符。避免使用关键字作为标识符。

所以, 伙计们, 这是关键字。请随时询问任何疑问。

坚持编码, 保持爱。

Please Guys avoid them to use as identifiers. Its my best suggestion to you in just one word. Avoid Keywords as Identifiers.

So guys, that’s it for keywords. Feel free to ask for any queries.

Till then Keep Coding, Keep Loving.

原文链接:https://medium.com/jay-tillu/keywords-in-kotlin-a429247a1802

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2018.11.06 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 硬关键字
  • 软关键字
  • Soft Keywords
  • 修饰符关键字
    • Modifier Keywords
      • 特殊标识符
        • Special Identifier
        领券
        问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档