Before adding this function below, the contract works well. But after adding the function, when I trying to deploy the contract, the remix IDE keeps showing the error message of "Gas estimation failed". Did something wrong with the function?
//return the user name by mapping the address
function find_user_name(address _address) public view returns(string){
uint256 i;
string account_name;
for(i=0; i < userlist.length; i++){//find the mapping user account name
if(_address == userlist[i].useraddress)account_name = userlist[i].account;
}
return account_name;
}