What does this syntax in solidity mean. for (;;) {}

Viewed 48

Could someone explain me please what the whole else block does?

Does it iterate once?

modifier checkEpoch {
        uint256 _nextEpochPoint = nextEpochPoint();
        if (now < _nextEpochPoint) {
            require(msg.sender == operator(), 'Epoch: only operator allowed for pre-epoch');
            _;
        } else {
            _;

            for (;;) {
                lastEpochTime = _nextEpochPoint;
                ++epoch;
                _nextEpochPoint = nextEpochPoint();
                if (now < _nextEpochPoint) break;
            }
        }
    }
1 Answers

I never used this in solidity but in c and javascript it is used for infinite loop.

For-loop will continue till this condition

if (now < _nextEpochPoint) break;

it is not an operator. for loop has 3 parameters

for (int i = 1; i <= 12; i++){}

Instead of passing inital value, end value and condition, we leave them blank

for (;;){}
Related