Set a Variable inside a conditional
You're trying to your float variable using another variable at the moment that isn't defined. I expect you mean to set float to the string value "yes" like so:

{% set float = "yes" %}

You could also use a conditional around your class declaration so you don't end up with empty classes and it'd also remove the need to define float as an empty value.

&lt;div{% if float is defined %} class="{{ float }}"{% endif %}&gt; more code here &lt;/div&gt;