My following function is a Generator function* generator(arr) {
now i want to pass from js to ruby, i want to stop the iteration to do that in js i stopped with .done
, in ruby how can i stop?
in javascript i used to use .done to stop the iteration of an Generator
like this:
function* generator(arr) {
}
function definition(){
const state = data.map(v => iterHeapsAlgo(v));
while(true) {
const isEnd = state.every((v,i) => {
let n = v.next();
if(n.done) {
now i am becomming my code from js to ruby
how can i stop the iteration if(n.done) {
in ruby?