0

Ruby - What does %w operator do?

3rd Feb 2020, 6:36 PM
Paolo De Nictolis
Paolo De Nictolis - avatar
3 odpowiedzi
+ 4
Its a literal, it allows you to create array of strings wirh no commas and quotes in syntax. Example: array= ['ggg', 'gdtg'] Or array =%w[ggg gdtg] It justs helps in syntax.
3rd Feb 2020, 6:48 PM
Black Winter
+ 1
I know this use, but it's not used exclusively with arrays
3rd Feb 2020, 7:21 PM
Paolo De Nictolis
Paolo De Nictolis - avatar
+ 1
Paolo De Nictolis yes indeed.
3rd Feb 2020, 7:22 PM
Black Winter