Sorting Recipes Alphabetically

Sort is array method where you can use to sort strings , hashes or arrays. It always take in two arguments (a,b) and means you will sort from least to greatest. it will return array when it finishes sorting.

Rupinder Kaur
Mar 29, 2021

To sort my recipes name alphabetically , i took response from the api. The api returns an array . All recipes are saved in class variable. In see_recipe method , it shows all recipe’s title . I put local variale equals to class vaiable to sort out all the recipes title alphabetically which will take arguments of two strings (a,b).

--

--