Duplicate code refers to sections of code that are identical or very similar in multiple places within a codebase.
Example 1
ref : class "Food"
```
case 1:price=quantity*50;
break;
case 2:price=quantity*60;
break;
case 3:price=quantity*70;
break;
case 4:price=quantity*30;
break;
```
The code contains repetitive calculations for determining the price based on the item number.
Duplicate code refers to sections of code that are identical or very similar in multiple places within a codebase.
Example 1
ref : class "Food" ``` case 1:price=quantity*50; break; case 2:price=quantity*60; break; case 3:price=quantity*70; break; case 4:price=quantity*30; break; ``` The code contains repetitive calculations for determining the price based on the item number.