Salesforce Fact #783 | add() method error

While using the add() method to add element in a list at a particular index, we need to be careful. Unlike other programming languages, we will encounter error if the list is empty. Attached is the screenshot.