evaluating a variable value as boolean

I have defined variable
happened: true

When am trying to use this variable in task in conditional when clause it failed
when: {{happened}} | bool == true it gives error.

what is the correct syntax to use it?

Hello Shashank,

This statement is getting failed because you didn’t use double quotes (" ") in your command.
The correct syntax to use this statement is:

when: "{{happened}} | bool == true"

Thanks
Soniya

conditionals already assume {{ }} context, so unless you are
specifically aiming at double interpolation `when: happened|bool` is
all you need