Using Visual Studio Code
10. Find and replace
There will be many times where you will want to swap a piece of code with another. It may be because you have copied the code from elsewhere and need it to match your own, or you want to change the name of a variable. If the code only occurs a few times in you code, you might consider changing it manually. However what if the code is repearted more than that and what if it is scattered across a file or even files?
All IDEs, and most text editing programs, have a tool to find a string of text and replace it with another. It's usually in the Edit menu and is called Replace or Find and Replace. The most common keyboard short cut for this tool is Ctrl-H.
Not only will find and replace get instances of the word you need to change, it'll often get instances you might otherwise forget, such as in comments.
In the example below, the a series of variables named beginning with "bullet" is replaced with "zombie". "bullet" is used 57 times in the file and missing one instance of it would break the code. Find and replace is the perfect tool to change this variable name.