samedi 25 juillet 2020

I want to avoid the amount of if-statements I have

In my code I have the user input and something I want printed to them.

For example:

If their input is "1", output "one",
If their input is "2", output "two",
If their input is "3", output "three",
If their input is "4", output "four"

And so on. How would I be able to make this but without using so many if-statements.

Aucun commentaire:

Enregistrer un commentaire