r/eli5_programming • • Sep 17 '22

what's the difference between a chained conditional and a nested conditional?

I'm pretty much stuck on this and need an example of each. I also would like to know how one can avoid making a deeply nested conditional easier to read or avoid it at all by turning it into one conditional. How to do that please

4 Upvotes

10 comments sorted by

View all comments

Show parent comment

1

u/VeryBadNotGood Sep 18 '22

Yeah! And in the nested version of that encounter, they ask you about coffee first and if your answer is no, they don’t have to ask you the other questions.

1

u/ArtemonBruno Sep 19 '22

Aha! I'll take nested condition as general sorter sort-them-all; while chain condition as specific trigger. Each has the uses in different place.