Join variables in twig I want to join two variables in twig in the user.html.twig

{{ content.field_firstname }} {{ content.field_lastname }}


How can i output them on the same line and add a space between them using twig ?

Everytime i try, they show on two different lines ? and i don't want to use css just for this.

Is there any better way to do this ? Many thanks
{% set full_name = [content.field_firstname ~ ' ' ~ content.field_lastname] %}

Note: We use ~ in twig to concatenate two or more strings instead of "+"