I was creating a program and I was trying to explain it to some of my coding friends. They commented that it was too tedious typing out all the "if" commands. How do I streamline this code?
Note: this is a ".bat" program.
@echo off set /p Food="What would you like to eat? " if /i %Food%==pizza findstr "Pizza" Menu.txt if /i %Food%==bread findstr "Bread" Menu.txt if /i %Food%==macaroni findstr "Macaroni" Menu.txt pause
Using the user input, the batch file looks inside Menu.txt and then it echos that description for that one food item.
Pizza | Flattened dough, layered with tomato sauce, cheese, and choice of toppings. Bread | Dough that has been baked. Macaroni | Macaroni pasta with cheese.