control flow

Flow control: If/else, switches and….dictionaries?

Flow control: If/else, switches and….dictionaries?

.NET languages have a variety of forms of flow control, if statements are easily among the most noticeable. When having to compare multiple statements it is common practice to utilize switch statements due to it’s improved performance, but is there another way? It turns out there is!  We can actually use a dictionary and delegates for flow control! Before we delve into this, how exactly are switch statements utilized by the compiler?

TLDR;

You can use dictionaries in place of large switches and the code is found here.

Continue reading →

Posted by DCCoder in General, Programming, 0 comments