# General question about function parameters and spaces

**URL:** <https://rubytalk.org/t/general-question-about-function-parameters-and-spaces/37768>\
**Category:** ruby-talk\
**Created:** [22 May 2007 18:34 UTC](https://rubytalk.org/t/general-question-about-function-parameters-and-spaces/37768 "2007-05-22T18:34:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_Steiner](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@Mike\_Steiner](https://rubytalk.org/u/Mike_Steiner)\
**Post date:** [22 May 2007 18:34 UTC](https://rubytalk.org/t/general-question-about-function-parameters-and-spaces/37768/1 "2007-05-22T18:34:12Z")

</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 Steiner

---

<div class="post-metadata">

**Author:** ![Sebastian\_Hungereck1](https://avatars.discourse-cdn.com/v4/letter/s/3ab097/32.png) [@Sebastian\_Hungereck1](https://rubytalk.org/u/Sebastian_Hungereck1)\
**Post date:** [22 May 2007 18:46 UTC](https://rubytalk.org/t/general-question-about-function-parameters-and-spaces/37768/2 "2007-05-22T18:46:39Z")

</div>

Mike Steiner 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

> **···**
>
> --  
> Ist so, weil ist so  
> Bleibt so, weil war so
