I read the official docs of Liquid but couldn’t find the info that I was looking for.
In the end, the below code worked for me:
{% if string != nil and string != "" %}
Do whatever with string
{% endif %}
Example code:
{% assign name="Blog" %}
{% if name != nil and name != "" %}
Yay!
{% else %}
Nay
{% endif %}
Output:
Yay!