Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundler reminder #86

Merged
merged 2 commits into from
Feb 28, 2024
Merged

Bundler reminder #86

merged 2 commits into from
Feb 28, 2024

Conversation

HKhademian
Copy link
Contributor

Hello Tsoding,
the operation of printing full rows and the last reminder row can both happen in a single impl.
the inner loop checks for both ROW count and also preserve overall SIZE limit.

here is a runnable example in JS:

var data = [...new Array(100)].map((_,i)=>i+101);

var row_size = 7;
for(let i=0; i<data.length; ) {
    var out = "    ";
    for (let w=0; w<row_size  && i<data.length; ++w, ++i) {
        out += data[i].toString() + ", ";
    }
    console.log(out);
}

outer loop counter should move only when we print each item, so I had to move it inside the second loop.

the operation of printing full rows and the last reminder row can both happen in a single impl.
the inner loop checks for both ROW count and also preserve overall SIZE limit.
@rexim
Copy link
Member

rexim commented Feb 28, 2024

Nice! Thank you so much!

@rexim rexim merged commit 9ddb4d2 into tsoding:master Feb 28, 2024
4 checks passed
@HKhademian HKhademian deleted the bundler-reminder branch April 12, 2024 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants