Skip to content

zadania utrwalakące pętle#144

Open
Amanitus wants to merge 1 commit intodevmentor-pl:masterfrom
Amanitus:master
Open

zadania utrwalakące pętle#144
Amanitus wants to merge 1 commit intodevmentor-pl:masterfrom
Amanitus:master

Conversation

@Amanitus
Copy link
Copy Markdown

Pętle

Copy link
Copy Markdown
Owner

@devmentor-pl devmentor-pl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Piotrze,

Jest ok - uważaj tylko na formatowanie kodu

Comment on lines +4 to +7
if (randomNumber > 5) {
for (let i = 5; i <= randomNumber; i++) {console.log(i); }
} else { console.log("Wylosowana liczba jest zbyt mała, aby użyć pętli.");
} No newline at end of file
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Staraj się pisać kod bardziej czytelny np.:

if (randomNumber > 5) {
    // co robimy jesli prawda
    for (let i = 5; i <= randomNumber; i++) {
        // co robimy wieloktronie
        console.log(i); 
    } // koniec pętli
} else { 
   // co robimy jesli falsz
   console.log("Wylosowana liczba jest zbyt mała, aby użyć pętli.");
}

for (let i = 1; i <= x; i++) {
result += i;
console.log(result);
} No newline at end of file
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

console.log("Liczba wylosowana:", randomNumber);
console.log("Liczba iteracji:", iteration); No newline at end of file
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

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