![]() At the time of creating variables by using use keyword, we need to choose the appropriate name. The use keyword identifier does not contain any symbols also, the identifier of the use keyword is not case sensitive. At the time of using the use keyword in it, whitespace is not accepted. The name identifier starts with the underscore or letter followed by zero and digits. In the use keyword of kotlin, we need to follow the rules and the naming convention. ![]() We are using the use function to open files for reading purposes. We are using the input file name as kotlinfile.txt for providing the input to the buffered Reader function. Also, we are using the argument as array string. In the above example, we are using the name fun as the main. Val inputfile = inputfile ("kotlinfile.txt") Use keyword is the part of the syntax, so we cannot use the same as an identifier. We cannot use keywords of use as identifiers in our program code. It will contain the special meaning of compiler. Use is the predefined and reserved keywords that we are using in the kotlin language of programming. The first kotlin will start as a language with the development of android then, it will quickly spread with a community of java because the feature of kotlin is very useful while developing applications. Kotlin is used to run the JVM also it will run side by side with java. ![]() By using the use of keywords, we are achieving this feature. ![]() Suppose we are reading any file, then we need to close it after the user suppose we are not closing this file it will go into an unstable state. There are multiple situations where we can use the resource after using the resource, we need to take care of this lifecycle so it will not leak any resources. Kotlin use function is used to execute the block function of the resource basically kotlin is the general purpose programming language, and JetBrains develop it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |