In the following generalised code example, would myMethod still be free (no gas cost) to call from outside the contract? Even if it does a series of operations including abi.encodePacked()?
contract A{
struct Data{
uint8 num;
bool include;
}
mapping (address => Data) dataMap;
/*
more functions
*/
function myMethod() public view returns (string){
string[2] memory array = ['a', 'b'];
if(dataMap[msg.sender].include){
return string(abi.encodePacked(array[dataMap[msg.sender].num], 'c'))
}
return array[dataMap[msg.sender].num];
}
}