To fulfill your requirement may be returns
may solve it.
function revealWinners() public returns (uint) {
for (uint id = 0; id <3; id++) {
Item storage currentItem=items[id];
if(currentItem.itemTokens.length != 0) {
uint randomIndex = (block.number /
currentItem.itemTokens.length)% currentItem.itemTokens.length;
uint winnerId = currentItem.itemTokens[randomIndex];
return winnerId;
}
}
}
update:
If you want to return any value from the function then you have to use return
keyword as other programming language do . As you see in the function
function revealWinners() public returns (uint){
you have to use returns(data_type_Or_datatype_with_name) in the function. so the function have to be like this:-
function functio_Name(agr1,agr2,..) returns (ret_arg1,ret_arg2,..){
//logic here
return(ret_arg1,ret_arg2,..)
}