"++" operator not recognized in pre-increment position, (++myVar)
See original GitHub issueChallenge Name
Issue Description
The test: Use the ++ operator fails when the pre-increment version of the “++” operator is used (i.e. “++myVar;”) rather than the post-increment version. Nothing in the description of the task precludes the pre-increment version being correct.
Browser Information
- Browser Name, Version: various
- Operating System: various
- Mobile, Desktop, or Tablet: multiple
Your Code
// If relevant, paste all of your challenge code in here
var myVar = 87;
// Only change code below this line
++myVar;
Screenshot
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Not able to understand the working of Pre-increment
The expression ++a is an lvalue while a++ is not and therefore it can't be the left operand of the assignment operator.
Read more >Solving issues in using post and pre increment operators as ...
This only works if <variable> is something that can be incremented (i.e. an l-value). For instance, (4 + 8)++ would NOT compile, even...
Read more >JavaScript arithmetic special operators - w3resource
The increment operator is used as follows: var1++ ( Post-increment ). ++var1 ( Pre-increment ). In the first case (i.e. post- ...
Read more >Iterators in C++: An Ultimate Guide to Iterators - Simplilearn
++it // Using pre increment operator. Swappable: The values of the two input iterators that are pointing to different positions can be ...
Read more >PHP Operators - Techotopia
The number and location of these operands in relation to the operators ... the result of the addition to the operand represented by...
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
Thanks ya’ll! I couldn’t have asked for a better outcome.
Having poked your backend with alternate ‘correct’ solutions to prior challenges and been impressed with your robust handling of them this situation stuck out a bit. And I was hoping to contribute to the polish of your beautiful project.
I appreciate the peak behind the curtain. It confirmed that the modification only required a simple regex edit and that ya’ll really are a copacetic group.
Kudos all around!
@erictleung Won’t the above code pass with just
myVar
? Since both++
sections are optional, that will match justmyVar
.Better to do:
/([+]{2}\s*myVar|myVar\s*[+]{2}/