pikapython/package/PikaStdLib/PikaStdLib_RangeObj.c
2022-10-13 01:24:58 +08:00

15 lines
326 B
C

#include "PikaObj.h"
Arg* PikaStdLib_RangeObj___next__(PikaObj* self) {
RangeData* _ = (RangeData*)args_getStruct(self->list, "_");
int end = _->end;
int step = _->step;
/* exit */
if (_->i >= end) {
return arg_newNull();
}
Arg* res = arg_newInt(_->i);
_->i += step;
return res;
}