# General question about function parameters and spaces

**URL:** <https://www.ruby-forum.com/t/general-question-about-function-parameters-and-spaces/104808>\
**Category:** Ruby\
**Created:** [May 22, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/general-question-about-function-parameters-and-spaces/104808 "2007-05-22T20:35:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [May 22, 2007, 8:35pm UTC](https://www.ruby-forum.com/t/general-question-about-function-parameters-and-spaces/104808/1 "2007-05-22T20:35:17Z")

</div>

Why does Ruby frown upon putting spaces between a function name and the  
left  
parenthesis of its argument lists? Why does it matter? Is there some  
other  
language construct that uses a similar syntax that confuses Ruby so  
much?

I just ran into an error with code like this:

print ( somefunc ( 1 ) + “abc” )

But rewriting it as below fixed the error:

print ( somefunc( 1 ) + “abc” )

Mike S.

---

<div class="post-metadata">

**Author:** ![mschwab](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/59ef9b/32.png) [@mschwab](https://www.ruby-forum.com/u/mschwab)\
**Post date:** [May 22, 2007, 8:47pm UTC](https://www.ruby-forum.com/t/general-question-about-function-parameters-and-spaces/104808/2 "2007-05-22T20:47:19Z")

</div>

Mike S. wrote:

> Why does Ruby frown upon putting spaces between a function name and the  
> left parenthesis of its argument lists?

Because parentheses are optional around function parameters and can also  
be  
used for precedence. Ruby uses the space before the parenthesis to tell  
whether they are used for the former or the latter. Example:

fun 1+3_5 == fun(1+3_5)  
fun (1+3)\*5 == fun((1+3)\*5) != fun(1+3) \* 5

HTH
