I'm aware of the fact that pure/view functions cost no gas with a simple "call". But what happens if i have a function that changes the contract state based on the pure/view function result. Do i have to pay gas for the pure/view functions looping if i do a "send"?
In my example I want to find a number in an array and return the index.
function indexOfUint(uint256[] _array, uint _value) public pure returns (uint256) {
bool exist;
for (uint i=0; i<_array.length;i++){
if(_array[i] == _value){
exist = true;
return i;
}
}
assert(exist == true);
}