3 ms·
What is the formal difference in Scala between braces and parentheses?
- keypusher 15y agoThe more I learn about Scala, the less interested I become.
- jamesaguilar 15y agoScala: forever { features append randomFeature } It's also OK to write this with parens. Maybe. I can't really tell.
- lrlucena 15y agoParentheses are used to define tuples and to apply functions. For functions with a single argument, parentheses are optional. In these cases you may need to use braces to enclose some expression. Example: 1 to 10 filter (_%2==0) The parentheses in this case are optional, but if you omit them you´ll have to put expression _%2==0 inside a pair of braces: 1 to 10 filter {_%2==0}
- lucian1900 15y agoI can't believe Scala's syntax is so horribly complex. Also, just horrible.