xxxxxxxxxx
function isExists(uint value) public view returns (bool) {
bool exists;
for (uint i; i<arr_items.length; ++i) {
if (arr_items[i] == value) {
exists = true;
}
}
return exists;
}
xxxxxxxxxx
// either use a mapping
mapping(address => uint8) myMap;
// write a for loop (try not to do this unless have to)
// try not to use less or equal to, use less instead
// gas optimisation
for (uint256 i = 0; i < 1; i++) {
if (searchList[i] == "toFindString") {
// do whatever
break;
}
}