Twig: length giving 1 on empty array? This code worked fine in Craft 2:

 {% set entries = craft.entries.section('events').relatedTo(category).orderBy('startDate asc').limit(3) %}
 {% set extraEntries = craft.entries.section('events').relatedTo(category).orderBy('startDate asc').offset(3) %}
 {% if extraEntries | length %}
    //do some stuff
 {% endif %}


In Craft 3, {{ extraEntries | length }} is giving a value a 1 even when there are no entries. For example, {% for e in extraEntries %}&gt;&gt;&gt;{{e}}{%endfor%} doesn't output anything. Any thoughts?
Because extraEntries is not an array of elements but an object of type EntryQuery in order to fetch the entries you have to do

{% set extraEntries = craft.entries.section('events').relatedTo(category).orderBy('startDate asc').offset(3).all() %}


It was actually the same in Craft 2 but the class had an iterable and countable interface, so when you do |length it actually does .total() (to execute the command and fetch the number of rows) These automatic mechanisms are removed/deprecated now thus you have to know what kind of object you use

When you take a look at your cp you'll see a bunch of deprecated warnings.

I suggest you to read the docs