hello world in kotlin

Since the c programming language ,we start with greeting the world when start learning a new programming language.

The kotlin hello world is a bit similar to that of Java :

This is how we say hello world in kotlin tongue:

fun main (args: Array<String>) {

println(“Hello world!”);

}

As you can see , there is no need to create the main function (method in Java) inside a class.

Also simply we used “println” instead of “System.out.println” to print hello world to the console.

We used “fun” to declare a function in kotlin .

اترك تعليقاً

لن يتم نشر عنوان بريدك الإلكتروني. الحقول الإلزامية مشار إليها بـ *

جميع الحقوق محفوظة لموقع كيفاش 2024