#๐ I don't understand how I am getting this error and I know how to fix it
15 messages ยท Page 1 of 1 (latest)
@loud light
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
well assuming that you do not have anything past the if-else that uses contact_obj, then the warning (not error) would be correct
what is your expected result?
... and to be clear, these are just linter warnings. If your code is still incomplete because you haven't done anything with context_obj yet, but are going to, these warnings can be ignored until later when things are complete.
Do I need contact_obj to be globalized and set the value to None?
I thought the variable would be referenced after the if block
If there's no code after the if block, what will reference it?
The else block comes after the if block
Ahh i see
I fixed it
Oh. Only one of those will run at any given time. So that doesn't count.
So this:
if whatever:
x = 1
else:
x = 2
does not use the value of x. But this:
if whatever:
x = 1
else:
x = 2
print(x)
does use it.
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.