Here is a contract from https://www.etherchain.org/account/0xc18a451d4ef2a85e7bf8404131c5f994a98bdb15#code
What exactly does idx
mean or do?
function enter() {
if (msg.value < 500 finney) {
msg.sender.send(msg.value);
return;
}
// add a new participant to array
uint idx = participants.length;
participants.length += 1;
participants[idx].etherAddress = msg.sender;
participants[idx].amount = msg.value;
// collect fees and update contract balance
if (idx != 0) {
collectedFees += msg.value / 10;
balance += msg.value;
}
else {
//code
}