Skip to content

Instantly share code, notes, and snippets.

View ostretsov's full-sized avatar
🏠
Working from home

Artem Ostretsov ostretsov

🏠
Working from home
View GitHub Profile
1.+(2)
(1).+(2)
val tuple = (1, 2, "Three", 'f')
import scala.io.Source
if (args.length > 0) {
val fileLines = Source.fromFile(args(0)).getLines().toList
val maxLengthLine = fileLines.reduceLeft((a, b) => {
if (a.length > b.length) a else b
}).length.toString().length
for (line <- fileLines) {
import ostretsov.Client
object ClientRepository {
def main (args: Array[String]): Unit = {
println(Client.build("Artem Ostretsov", true).id)
println(Client.build("Martin Odersky", true).id)
println(Client.build("Vasya Pupkin", false).id)
println(Client.build("Artem Ostretsov", false).id)
}
package ostretsov
import scala.collection.mutable
/**
* Created by rufog on 27.12.14.
*/
object Client {
var lastId = 0;
class DummyClass {
def dummy(x: Integer, y: Integer): Unit = println("x: "+x+", y: "+y)
}
def test(): Unit = "Test is Ok!"
object EntryPoint {
def main(args: Array[String]): Unit = {
for (arg <- args) {
println(arg)
}
}
}
println(1.toString) // outputs what is expected
println(1.toString()) // ok
println("scala is great!".capitalize) // ok
println("scala is great!".capitalize()) // Error!!!
val a = math.pow(2, 32).toInt
println(a.getClass+": "+a)