Skip to content
Advertisement

Syntax for an If statement using a boolean

I just recently joined the python3 HypeTrain. However I just wondered how you can use an if statement onto a boolean. Example:

JavaScript

And also, can I just switch the value of a boolean like this?

JavaScript

Advertisement

Answer

You can change the value of a bool all you want. As for an if:

JavaScript

works, but you can also use:

JavaScript

If you want to test whether something is false you can use:

JavaScript

but you can also use:

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement