Reputation: 123
For some reason when I declare a variable within a function using PyCharm, the font color is the same as if it were a comment (See picture). Anyone else having this problem? I didn't change any setting it just started happening, very frustrating!
Upvotes: 3
Views: 7721
Reputation: 307
You can go to settings > editor > color scheme > custom and change the color for Line Comment
Same way settings > editor > color scheme > Python and change the color for variable
Upvotes: 3
Reputation: 3535
This is due to x is not used by any other function or code. If you hover your cursor over it for few second, the warning would tell you what's the reason.
Upvotes: 1
Reputation: 56
That usually happens when you have not interacted with the variable anywhere else in the function.
For example, if you added a line after such as:
print x
the color would change back.
Upvotes: 2