This is a quick guide to Kotlin programming language. The previous part of this guide is here
#Object Oriented
fun main(args : Array<String>) {
class local (val x : Int)
val y = local(10)
println("${y.x}")| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # CUI Downloader of "Command Line Tools for Xcode" | |
| # by Akihiro Uchida, CC0 dedicated to the public domain | |
| # see http://creativecommons.org/publicdomain/zero/1.0/ | |
| import sys, os | |
| import urllib, urllib2, cookielib | |
| from getpass import getpass | |
| from HTMLParser import HTMLParser |
| import tkinter | |
| from time import strftime | |
| #by Luciano Ramalho | |
| clock = tkinter.Label() | |
| clock.pack() | |
| clock['font'] = 'Helvetica 120 bold' | |
| clock['text'] = strftime('%H:%M:%S') | |
| <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> | |
| <script> | |
| function currentPageFormatter(event) { | |
| var formattedStr; | |
| if (event.indexh === 0) { | |
| return ""; | |
| } | |
| formattedStr = event.indexh; |
This is a quick guide to Kotlin programming language. The previous part of this guide is here
#Object Oriented
fun main(args : Array<String>) {
class local (val x : Int)
val y = local(10)
println("${y.x}")#Intro
Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3
Kotlin project website is at kotlin.jetbrains.org.
All the codes here can be copied and run on Kotlin online editor.
Let's get started.
| <?xml version="1.0" encoding="utf-8"?> | |
| <resources> | |
| <style name="Theme.AppCompat.Light.NoActionBar" parent="@style/Theme.AppCompat.Light"> | |
| <item name="android:windowNoTitle">true</item> | |
| <item name="windowActionBar">false</item> <!-- For 2.x version --> | |
| </style> | |
| </resources> |
| #!/usr/bin/env monkeyrunner | |
| import time | |
| from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice | |
| device = MonkeyRunner.waitForConnection() | |
| # Touch down screen | |
| device.touch(100, 500, MonkeyDevice.DOWN) |
| package com.badlogic.drop; | |
| import com.badlogic.gdx.Game; | |
| import com.badlogic.gdx.graphics.g2d.BitmapFont; | |
| import com.badlogic.gdx.graphics.g2d.SpriteBatch; | |
| public class Drop extends Game { | |
| SpriteBatch batch; | |
| BitmapFont font; |
| #!/bin/zsh | |
| # | |
| # Highlight a given file and copy it as RTF. | |
| # | |
| # Simon Olofsson <simon@olofsson.de> | |
| # | |
| set -o errexit | |
| set -o nounset |