---
# System prepended metadata

title: '[ruby][method]用symbol做為方法的參數'
tags: [ruby, method]

---

# [ruby][method]用symbol做為方法的參數
###### tags: `ruby`,`method`

https://www.justinweiss.com/articles/fun-with-keyword-arguments/

```ruby
def ttt(a=1,b=2,c: 3, d:)
    "#{a},#{b},#{c},#{d}"
end

p ttt(1,2,d:4) #=>1,2,3,4
p ttt(1,2,c:30,d:4) #=>1,2,30,4
p ttt(1,2,{c:30,d:4}) #=>1,2,30,4
p ttt(1,2,{:c=>30,:d=>4}) #=>1,2,30,4
```

