Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

//

// concat
//
var num =
var one :
var ans =
print(num

string with declaration


"The number to print is"
float = 1.29f
"times less than the original"
+ " " + one + " " + ans)

// finding greater of 3 numbers


var x = 5
var y = 6
var z = 7
if(x > y && x > z) {
print("x is greater")
}
else if (y > x && y > z) {
print("y is greater")
}
else {
print("z is greater")
}
//printing 1 to 10 numbers in for loop
for(i in 0|..10)
{
print(i)
}
// printing date
var date = new Date()
print("Current date and time is : " + date)
// using lambda function
var los = {"This", "is", "a", "list"}
var p = los.toString()
var r = los.where( \ s -> s.length > 0 )
.map( \ s -> s.toUpperCase() )
.orderBy(\ s -> s )
print( p + "\n"+r.join(" ") )
var q = los.where( \ s -> s.length > 0 )
.map( \ s -> s.toLowerCase() )
.orderByDescending( \ s -> s )
print(q.join(" "))
// not able to use enhancements

You might also like