After about two months learning everything I can about ruby I have come to grow a love for it. I love how simple the programing langue is to write out and how easy it to read as I code. I had to build a CLI gem for my final project for phase one at flatiron. I went ahead I decided to build a Star Wars lookup anything you want cli where a user can choose from a list of 6 categorizes and then get back a list of names to choose from within that category. Next it will print out all the info on that name than the user chosen from. Next the user can go back to the start or list out all the names again. I did this by getting data from the SWAPI api.
One of the hardest challenges that I had to over come was finding a way to not let the user break out of the second loop once they get into listing all the names if they enter in the wrong thing or if the wanted to list all the names again. I over came this with setting a variable to nil and the loop will break once that variable is set to true. I first tried to set it to exit like I did on the first loop but it will cause a edge case where once you type in exit in the second loop you will break into the first loop resting it to ask the user for there input again and not exiting out of the cli.
This was a really fun project to build out and really helped me learn how to over come some challenges that I had to over come. I'm really exited to work on my next big project on Sinatra which will be in the next two months from now!
Top comments (0)