I'm new to solidity and smart contract programming. I'm currently using the online remix IDE to run my program. I want to display a error message when the user tries to ask for the value of an array element that does not exist.
This is my array
offer[] public asks;
If my understanding is correct the above line automatically generates a getter function, the user inputs the array index value 'i' and the function returns asks[i]
, how do I prompt a error message saying 'array index exceeded' when the user inputs invalid index value?