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}")
/* | |
Implements different bin packer algorithms that use the MAXRECTS data structure. | |
See http://clb.demon.fi/projects/even-more-rectangle-bin-packing | |
Author: Jukka Jylänki | |
- Original | |
Author: Claus Wahlers | |
- Ported to ActionScript3 |
#!/bin/bash | |
# list of programs we depend on | |
progs="xdpyinfo grep head sed ffmpeg pacat parec sox" | |
# check for programs we depend on | |
result=0 | |
for prog in $progs | |
do | |
type -p $prog > /dev/null |
function scaleAroundPoint(target:DisplayObject, point:Point, scaleFactor:Number):void | |
{ | |
var m:Matrix = target.transform.matrix; | |
m.translate( -point.x, -point.y ); | |
m.scale( scaleFactor, scaleFactor); | |
m.translate( point.x, point.y ); | |
target.transform.matrix = m; | |
} |
package com.asmoprime.utils; | |
/** | |
* ... | |
* @author Asmageddon | |
*/ | |
class Copy { | |
/** | |
* Deep copy of anything using reflection (so don't hope for much performance) | |
**/ |
data:text/html, <style type="text/css">.e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div class="e" id="editor"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("editor");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script> | |
<!-- | |
For other language: Instead of `ace/mode/ruby`, Use | |
Markdown -> `ace/mode/markdown` | |
Python -> `ace/mode/python` | |
C/C++ -> `ace/mode/c_cpp` | |
Javscript -> `ace/mode/javascript` | |
Java -> `ace/mode/java` | |
Scala- -> `ace/mode/scala` |
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.
#Control Structures
##If statement
Kotlin if statement should look familiar with other language
fun main(args : Array<String>) {
val total = 10
import haxe.macro.Expr; | |
class FTW | |
{ | |
public static function build() | |
{ | |
return haxe.macro.Context.getBuildFields().map(transformField); | |
} | |
static function transformField(field:Field) |