alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (repl-parens.check)

This example Scala source code file (repl-parens.check) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

int, int, iterator, scalaobject, scalaobject, string, type, type, x, x

The Scala repl-parens.check source code

Type in expressions to have them evaluated.
Type :help for more information.

scala> (2)
res0: Int = 2

scala> (2 + 2)
res1: Int = 4

scala> ((2 + 2))
res2: Int = 4

scala>   ((2 + 2))
res3: Int = 4

scala>   (  (2 + 2))
res4: Int = 4

scala>   (  (2 + 2 )  )
res5: Int = 4

scala> 5 ;   (  (2 + 2 )  ) ; ((5))
res6: Int = 5

scala> (((2 + 2)), ((2 + 2)))
res7: (Int, Int) = (4,4)

scala> (((2 + 2)), ((2 + 2)), 2)
res8: (Int, Int, Int) = (4,4,2)

scala> ((((2 + 2)), ((2 + 2)), 2).productIterator ++ Iterator(3) mkString)
res9: String = 4423

scala> 

scala> 55 ; ((2 + 2)) ; (1, 2, 3)
res10: (Int, Int, Int) = (1,2,3)

scala> 55 ; (x: Int) => x + 1 ; () => ((5))
res11: () => Int = <function0>

scala> 

scala> () => 5
res12: () => Int = <function0>

scala> 55 ; () => 5
res13: () => Int = <function0>

scala> () => { class X ; new X }
res14: () => java.lang.Object with ScalaObject = <function0>

scala> 

scala> def foo(x: Int)(y: Int)(z: Int) = x+y+z
foo: (x: Int)(y: Int)(z: Int)Int

scala> foo(5)(10)(15)+foo(5)(10)(15)
res15: Int = 60

scala> 

Other Scala examples (source code examples)

Here is a short list of links related to this Scala repl-parens.check source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.