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

Lines Problem - Official Solution Incorrect #91

Closed
smiller333 opened this issue Dec 11, 2014 · 4 comments
Closed

Lines Problem - Official Solution Incorrect #91

smiller333 opened this issue Dec 11, 2014 · 4 comments
Labels

Comments

@smiller333
Copy link

The official solution has the toLowerCase() and toUpperCase() methods on the wrong sides of the ternary expression based on the wording in the challenge. "... convert even-numbered lines to upper-case and odd-numbered lines to lower-case. Consider the first line to be odd-numbered. ..."

Also, the lineCount is defaulted to 0 and the increment is not called until after the output has been queued. This would mean that the first line will be upper case instead of lower case, assuming the above error has been fixed. Either lineCount needs to be defaulted to 1 or the increment call needs to be before the output is queued.

@tk120404
Copy link

0%2 is equal to 0, so the first line which is nothing but line[0] will be converted to lowercase and the second line which is nothing but line[1] will be converted to uppercase.

@wachunei
Copy link

I think the most logical "fix" for the solution code is to start counting from 1, since the first line is considered odd numbered.

@kalinchernev
Copy link
Member

I tested the official solution and it passed, so I don't understand why the issue is saying it's incorrect. I think the issue is rather saying that the syntax used in the example solution is not very readable?

@ccarruitero
Copy link
Contributor

Closing since it's stale from a lot of time ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants