+ 5

How to sort alphabetically in ruby

How to sort a string array alphabetically in ruby

23rd May 2020, 3:24 PM
Bot
Bot - avatar
6 odpowiedzi
+ 5
Oh, well, of course if you want to do it in-place, you should add an exclamation mark: arr.sort! (consider refreshing the tutorial, as this is a pretty basic syntax property of Ruby)
23rd May 2020, 4:16 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
Kuba Siekierzyński thanks for your help 🙏
23rd May 2020, 4:23 PM
Bot
Bot - avatar
+ 2
You can use the .sort method to accomplish that: (fourth tab under this link) https://www.sololearn.com/learn/Ruby/2769/
23rd May 2020, 4:02 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
But it's not working
23rd May 2020, 4:04 PM
Bot
Bot - avatar
+ 1
Proলয় मिश्ra Show the code, please. It should work alright.
23rd May 2020, 4:10 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar