简体   繁体   中英

What is the use of comma in Elixir?

I am new to elixir and was going through sample chat application written in it using phoenix framework. I am not able to understand meaning of this line

channel "rooms:*", Chat.RoomChannel

I searched online for this type of syntax but could not got the answer I was looking for. I know that Chat.RoomChannel is a module and channel follows a string which identifies type of room under consideration

I want to know how that syntax works

The comma seperates the argument list.

I guess you are getting confused that this is a function call. In elixir when calling a function its optional to give paranthesis. So

channel "rooms:*", Chat.RoomChannel

Is equivalent to

channel("rooms:*", Chat.RoomChannel)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM