Intern — Junior
Explain what a boolean variable is in programming.
sobes.tech AI
Answer from AI
A boolean variable is a data type that can only take two values: True or False. It is used to store the results of logical expressions and conditions, for example, to check whether a certain condition is met.
Example in Python:
is_active = True
is_logged_in = False
if is_active and is_logged_in:
print("User is active and logged in")
else:
print("Access denied")