groovy: use brackets on method calls or not? -


this general question whether people should using brackets on method calls take parameters or not. i.e.

def somefunc(def p) { ... } 

then calling:

somefunc "abc" 

vs...

somefunc("abc") 

is question of consistency, or there specific use cases each?

it's question of consistency , readability, note groovy won't let away omitting parentheses. one, can't omit parentheses in nested method calls:

def foo(n) { n } println foo 1 // won't work 

see section entitled "omitting parentheses" in style guide.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -