------art_39686_19124064.1173970623361
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

You have to see the statement in its entirety. Its centered around the
ternary operator ?:

What the code is doing is:
if (user.id recipient_id) {
  sender
} else {
  recipient
}


On 3/15/07, jko170 <jko170 / gmail.com> wrote:
>
> Looking at this piece of code, what does the colon do?
>
> def partner_to(user)
>     raise ArgumentError unless user
>     user.id recipient_id ? sender : recipient
> end
>
> I got the code from this rails post:
>
> http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/7fdccddde9b97ffc/6112294580b9e0ce?lnkt&qternal+mail&rnum6112294580b9e0ce
>
> I'm just asking because I've never seen the colon used before.
>
>
>

------art_39686_19124064.1173970623361--