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).

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Rupinder Kaur
Rupinder Kaur

No responses yet

Write a response