Skip to main content
added 255 characters in body
Source Link
user
  • 387
  • 2
  • 21
  • 68

Optional braces

In match expressions, at least, you can save a byte by using indentation-based syntax.

a match
case b=>c
case d=>e

is 27 bytes, while the below code is 28.

a match{case b=>c case d=>e}

As a side note, match also gets special treatment when it comes to chaining. The following Scala 2 code:

("foo"match{case x=>x})match{case x=>x}

can now be written without the parentheses:

"foo"match{case x=>x}match{case x=>x}

Optional braces

In match expressions, at least, you can save a byte by using indentation-based syntax.

a match
case b=>c
case d=>e

is 27 bytes, while the below code is 28.

a match{case b=>c case d=>e}

Optional braces

In match expressions, at least, you can save a byte by using indentation-based syntax.

a match
case b=>c
case d=>e

is 27 bytes, while the below code is 28.

a match{case b=>c case d=>e}

As a side note, match also gets special treatment when it comes to chaining. The following Scala 2 code:

("foo"match{case x=>x})match{case x=>x}

can now be written without the parentheses:

"foo"match{case x=>x}match{case x=>x}
Post Undeleted by user
Post Deleted by user
Source Link
user
  • 387
  • 2
  • 21
  • 68

Optional braces

In match expressions, at least, you can save a byte by using indentation-based syntax.

a match
case b=>c
case d=>e

is 27 bytes, while the below code is 28.

a match{case b=>c case d=>e}