Liquid Error: comparison of Integer with String failed

Hello,

I am trying to count the cart quantity of all products but I keep getting the below error

comparison of Integer with String failed.

on this line: {% if cartcount >= ‘4’ and cartcountsample >= ‘1’ %}

The numbers are correctly being added, when I display {{ cartcount }}, but when it comes time to display the button is when i get the error.

{% assign cartcount = 0 %}
{% assign cartcountsample = 0 %}
{% for item in cart.items %}
{% if item.product.tags contains 'Non-Sample' %}
{% assign cartcount = cartcount | plus:1 %}
{% endif %}
{% if item.product.tags contains 'Sample' %}
{% assign cartcountsample = cartcountsample | plus:1 %}
{% endif %}
{% endfor %}
{% if cartcount >= '4' and cartcountsample >= '1' %}

{% elsif cartcount >= '4' and cartcountsample == '0' %}

{% elsif cartcount == '0' and cartcountsample >= '2' %}

{% else %}
please add more.
{% endif %}

Try to use

{% if cartcount >= 4 and cartcountsample >= 1 %}