isaced / SwiftRubyStyle

Write Ruby style code in Swift.

Repository from Github https://github.comisaced/SwiftRubyStyleRepository from Github https://github.comisaced/SwiftRubyStyle

SwiftRubyStyle

Write Ruby style code in Swift.

puts

puts("hello") // hello

times

3.times {
    puts("hi")
}

// hi
// hi
// hi

// or
5.times { i in
    puts(i)
}

// 0
// 1
// 2
// 3
// 4

String

// count
["a"].count           // 1
["a","b"].size        // 2
["a","b","c"].length  // 3

// append
"hello " << "world"   // hello world

// *
"a " * 3              // a a a

Array

// Hello
// Swift
// Ruby

// *n
["a"] * 3             // a a a
["A", "B"] + ["C"]    // A B C

Dictionary

// each
_ = ["A": "Hello A", "B": "Hello B"].each { (k, v) in
    puts(k)
    puts(v)
}

About

Write Ruby style code in Swift.

License:MIT License


Languages

Language:Swift 100.0%