Since a picture is worth at least 42 words, take a look at the following code:
public double SquirrelPriority => GetGene(Genes.ActorGeneIndex.Squirrel); public double DoggoPriority => GetGene(Genes.ActorGeneIndex.Doggo); public double RabbitPriority => GetGene(Genes.ActorGeneIndex.Rabbit); public double AcornPriority => GetGene(Genes.ActorGeneIndex.Acorn); public double TreePriority => GetGene(Genes.ActorGeneIndex.Tree); public double RandomPriority => GetGene(Genes.ActorGeneIndex.Random);
Notice the use of the
=> operator for arrow functions? Now take a look at how this renders in my development environment (Visual Studio 2019):
See how the arrow functions now literally appear as arrows? This little bit of extra flair is a delighter that reinforces the use of these modern operators.
This isn’t just limited to arrow functions, however. Take a look at these other operators:
<| respectively – it gets hard to tell on the pipe operators at the end.
=== which can be the difference between spotting a bug and missing it.
So, how do you get started with this?
First, install the Fira Code font by downloading and installing a font from its GitHub repository. You should be fine to only install the regular variant, but you could install the others if you wanted.
Next, open your favorite editor’s font dialog and change your font to Fira Code.
Finally, close the editor and restart it. This will ensure that the ligatures I described above are enabled. This may not be necessary in all development environments, but it is in Visual Studio.
And that’s it! You should be good to go.
Hopefully this modern take on our language features delights you as much as it does me. Personally, the added degree of polish makes me feel just a bit more awesome and capable.
Let me know what you think or what other techniques you use to stay awesome and productive in your editor of choice.