Skip to content

03 Ruby

Everything is an object!

![[Screen Shot 2024-01-25 at 11.12.00.png]]

  • the parentheses are optional

![[Screen Shot 2024-01-25 at 11.18.17.png]] - %w[] = word array - there is implicit return, by default, it will return the value in the last line

Destructive and predicate method

![[Screen Shot 2024-01-25 at 11.22.25.png]] - ! = 改变原先的值 - ?= return boolean - .to_a: convert to array