Write your First Line of Code in Kotlin for Android!

<p>In 2017, Google announced Kotlin as an official programming language for Android development. At the Google I/O conference held in May 2017, Google declared Kotlin a first-class language for Android app development, alongside Java. This means developers can use Kotlin to build Android applications with full support and integration from the official Android development tools and libraries.</p> <h1>Write Your First Line of Code in Kotlin!</h1> <p>You only need an updated browser with an internet connection to compile and run your first LOC (Line of Code) in kotlin.</p> <p>In your browser, open&nbsp;<a href="https://developer.android.com/training/kotlinplayground?authuser=1" rel="noopener ugc nofollow" target="_blank">https://developer.android.com/training/kotlinplayground?authuser=1</a>, this will open a browser-based programming tool.</p> <p>You will see the interface similar to the screenshot attached.</p> <p><img alt="" src="https://miro.medium.com/v2/resize:fit:630/1*3VdUvzKjN2PvTdlzGOZXMw.png" style="height:362px; width:700px" /></p> <p>Kotlin Playground</p> <h1>Run the First Program</h1> <p>To run, click on the green triangle button and see what happens.</p> <pre> Hello World!</pre> <p>The above is the output that will generate.</p> <p>Now, let&rsquo;s understand what it really means.</p> <h1>Understand the Program</h1> <pre> fun</pre> <p><strong>fun</strong>&nbsp;means the&nbsp;<strong>function</strong>&nbsp;in kotlin programming language. A function contains some line of code to perform some specific task.</p> <pre> fun main()</pre> <ol> <li><strong>main</strong>&nbsp;is the function name, it is like the entry point not for kotlin but for every programming language. It is the function that is called when you run the program.</li> <li>The Parenthesis () contains some argument i.e., input to the function.</li> </ol> <pre> fun main() { }</pre> <p>The curly braces {} contain a block of code to be executed.</p> <pre> fun main() { println(&quot;Hello World!&quot;) }</pre> <ol> <li>The&nbsp;<strong>println()</strong>&nbsp;tells the system to print some lines.</li> <li>As you can see inside the parenthesis (), there exists a quotation, which means you tell the system to print as exactly as given inside it.</li> </ol> <p><a href="https://medium.com/@vishkatyan/write-your-first-line-of-code-in-kotlin-for-android-8628bb18f4e3">Visit Now</a>&nbsp;</p>
Tags: Android Kotlin