Task 1/2: What is Extract Variable refactoring?
A magic number is a numerical value used in the code without a comment explaining its purpose. Using magic numbers in code is considered bad practice because it makes the code prone to errors and less maintainable and readable.
To resolve this problem, you can press the &shortcut:IntroduceConstant; (macOS) or Ctrl+Alt+C
(Windows/Linux) shortcut to create a constant variable
with a meaningful name and use it in the code.
If there are duplicated values in the code (string values or just lines of code),
you can use the &shortcut:IntroduceVariable; (macOS) or Ctrl+Alt+V
(Windows/Linux) shortcut to introduce a variable.