Semicolon on while statement causes challenge failure
See original GitHub issueChallenge Name
https://www.freecodecamp.com/challenges/smallest-common-multiple
Issue Description
Using the sample solution in the wiki article for this algorithm, for a do…while loop, if you include the required semicolon after the while, you get “SyntaxError: Unexpected token ;”. If you take the semicolon out, you get a stop sign on the line saying that the semicolon is missed, but the challenge passes.
Browser Information
- Browser Name, Version: Chrome, 52.0.2743.60 beta-m
- Operating System: WIndows 10 Home
- Mobile, Desktop, or Tablet: Desktop
Your Code
do {
quot = newArr[0] * loop * newArr[1];
for (n = 2; n < newArr.length; n++) {
if (quot % newArr[n] !== 0) {
break;
}
}
loop++;
} while (n !== newArr.length);
Screenshot
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (8 by maintainers)
Top Results From Across the Web
My C language code contains a line as follows: while ... - Quora
C is designed to ignore line endings. The compiler responds only to the semicolon to complete a statement. The C pre-processor does respond...
Read more >Trivial Do While Loop - C2 wiki
A trivial do/while loop is a useful device in CeeLanguage consisting of a do/while loop with ... because a trailing semicolon will cause...
Read more >Risks & Errors in While, For & Do While Loops in C - Study.com
The misplaced semicolon can create problems with a while loop. Though this loop looks correct, because there's a semicolon after the while ...
Read more >What happens if you put a semi colon after while statment in C++
The semicolon after the while statement means a null statement. That is the sub-statement of the while statement is the null statement.
Read more >Semicolon Inference - Programming Linguistics
Although a semicolon may be specified, it is not required to terminate a statement. This post explores the underlying rules various languages ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@flipsyde606: By all means, any issue that’s tagged as Help Wanted is open to all for a fix. You needn’t request permission. Thanks a lot.
@flipsyde606: If this is a bug in the loop-protect library then we can log a issue on their repo. But I am not sure that its very well maintained. The published fork on npm is a fork of the original.
Anyways: Option 1 and Option 2 are a strict NO GO.
Option 3 is a work around, but we still would need to detect this for do…while loops. Of course we can tell the campers to use this in all algorithm challenges but then that beats the purpose of having it in the first place.
/cc @FreeCodeCamp/issue-moderators thoughts?