On Fri, Jul 10, 2009 at 1:01 PM, rajkumargoel_786 wrote:

> object lists{
> def main(args:Array[String]){
> val nums=List(1,2,3,4,5,6,7,8,9,0)
> val fruits=List("Apple","Banana","Cheekoo","Jack
> Fruit","Grapes","Mango","Orange","Papaya")
> println(nums)
> println((nums.tail).tail)
> println(fruits.head)
> println(fruits.tail)
> println(fruits)
> }
> }
>
>
> HOW TO WRITE ALL PRINTLN 'S IN ONE LINE
>
> i AM GETTING ERROR IF I WRITE "+" IN BETWEEN so how do we do that in scala
> Thanks,
> Rajkumar Goel
> www.twitter.com/rajkumargoel
>
>
>
> ------------------------------------
>
> http://twincling.org/
> http://twitter.com/twincling
> ----------------------------------------
> Yahoo! Groups Links
>
>
>
> hi Rajkumar,

Try this code:

object lists{
def main(args:Array[String]){
val nums=List(1,2,3,4,5,6,7,8,9,0);
val fruits=List("Apple","Banana","Cheekoo","Jack
Fruit","Grapes","Mango","Orange","Papaya");
Console.print(nums);
Console.print((nums.tail).tail);
Console.print(fruits.head);
Console.print(fruits.tail);
Console.print(fruits);
}
}

i've used print instead of println. I used Console.print instead of print
because i am using Scala ver 2.3 and not 2.5.

Also, "+" worked in my case, ie the following code worked:

object lists{
def main(args:Array[String]){
val nums=List(1,2,3,4,5,6,7,8,9,0);
val fruits=List("Apple","Banana","Cheekoo","Jack
Fruit","Grapes","Mango","Orange","Papaya");

Console.println(fruits.head+fruits.tail);

}
}

Regards,
Kartik Nayak


[Non-text portions of this message have been removed]

Reply via email to