How to call if a variable is true ?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By binkiklou
:warning: Old Version Published before Godot 3 was released.

Hello, I’m trying to make dialogs for my games and I would like to know how doing something like if a == true A is my variable. I tried if (A == true): but it kept making errors. Please help me.

That seems correct to me, so the error probably is not in that piece of code. Can you put more about the context and the error messages you have?

garred | 2016-11-06 19:00

if you are using a Boolean variable you can simple say

if a:
     some code here :)

since the == return a Boolean just like the Boolean variable

rustyStriker | 2016-11-06 20:06

It keep saying Expected intended block after ‘if’

binkiklou | 2016-11-06 20:17

Indented, not intended. In Python and GDScript you have to indent blocks, as rustyStriker and eons told you.

garred | 2016-11-06 20:44

:bust_in_silhouette: Reply From: eons

About if/else/elif in GDScript entry on docs:
https://godot.readthedocs.io/en/stable/reference/gdscript.html#if-else-elif

Remember to respect tab/space indent, look at demos too.