battle programminga forum for elite programmerswith extreme will powerto sharpen theire skills
 
HomeCalendarFAQSearchMemberlistUsergroupsRegisterLog in
Share
 

 kotlin AS PL grimoire

Go down 
AuthorMessage
Moti Barski

Moti Barski

Posts : 293
Join date : 2011-08-02

kotlin AS PL grimoire Empty
PostSubject: kotlin AS PL grimoire   kotlin AS PL grimoire EmptySun Mar 17, 2019 5:06 am

kotlin is a new programming language for android studio
its main benefit is you no longer have to use findviewbyid, instead you
have to have a new name for each view in the app

click convert to java at the kotlin online play ground to convert :
https://try.kotlinlang.org

also : kotlin projects can use java classes

to install an emulator :
avd manager, create virtual device
select webcam for the camera (on verify config screen on advanced settings
after installing an emulator)

or just use an actual device.

:tokushushoukan

_________________
MB over and out _______________________     :trueogre:
Back to top Go down
View user profile
kurosen

kurosen

Posts : 77
Join date : 2012-04-17

kotlin AS PL grimoire Empty
PostSubject: kotlin hello world   kotlin AS PL grimoire EmptyMon Mar 25, 2019 11:54 am

open a new project as in android studio

in the java folder, 1st package, right click add a new kotlin class and call it main :

Code:
package com.example.hellokotlin

fun main(args: Array<String>){println("hello kotlin grimoire")}

to run click the arrow to the left of the code or the green arrow at the toolbar
or control + r to run on a Mac
:rlx:
Back to top Go down
View user profile
kurosen

kurosen

Posts : 77
Join date : 2012-04-17

kotlin AS PL grimoire Empty
PostSubject: kotlin comment code   kotlin AS PL grimoire EmptyMon Mar 25, 2019 12:01 pm

// comment
/* multi line comment
*/
Back to top Go down
View user profile
Moti Barski

Moti Barski

Posts : 293
Join date : 2011-08-02

kotlin AS PL grimoire Empty
PostSubject: kotlin variables   kotlin AS PL grimoire EmptyMon Mar 25, 2019 2:24 pm

var str ="hadouken";print(str) // string
var n = 4;print(n) // int
var numba:Int = 32; // explicit
var name:String = "chii"
println("$name is $numba") // string megazord

//optional (null or var):
var myDouble: Double? = null;myDouble = 45.1
print(myDouble)

var myBool: Boolean? = null;myBool = true

_________________
MB over and out _______________________     :trueogre:
Back to top Go down
View user profile
 
kotlin AS PL grimoire
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
battle programmers alliance :: battle programming alliance :: battle programming-
Jump to: