Checking if a field contains information I have read docs on Craft CMS site and Googled some related articles but can't seem to get my head around checking for conditions for a field.

For example, if I have a 'Fruit' field drop-down:
Apple
Banana
Orange

Should I add a 4th value with 'null'? So in my template, I want to display the field if it is Apple, Banana or Orange but not if null.

I get confused when to to use '|length'  or 'is empty' or 'is not' conditionals.

In another example, I tried to setup a drop-down for a field called 'Rating'
The values were 1, 2, 3, 4, 5
I couldn't get the conditional to work, so I thought to make the field a number type. And then I tried a conditional 'rating > 0' but also didn't succeed.
If you want a Dropdown field with the option to not select a value (or to clear out the current selection), you can just add an option (typically the first) with an empty value column. If the empty value/option is selected, the following conditional will evaluate to false, and if any other, non-empty value is selected it will evaluate to true:

{% if entry.dropdownFieldHandle %}
    I have a value: {{ entry.dropdownFieldHandle }}
{% else %}
    I have no value in the dropdown
{% endif %}


Note that for Dropdown fields its also possible to leave the label column empty, or to use something like "Pick a value..." as a placeholder.

If you use null instead of an empty value, the above conditional will always evaluate to true, because Twig will treat the value null as a string (i.e. "null"), not an actual NULL value.

As for the |length filter, since your question brings it up – the only thing |length does is to return the length of whatever variable its suffixed to. For an iterable object (like an array or a relational field like Assets or Entries) the length will be the amount of elements in that object (for instance, the number of Assets selected in an Assets field); for strings and numbers it will be the number of characters (meaning "foo"|length and 123|length will both return 3).

The reason |length is often used in conditionals, is that 0 is considered a "falsey" value, and any length larger than 0 is considered a "truthy" value. In other words, a conditional like {% if ""|length %} will be evaluated to false, because "" is an empty string and hence will return 0 characters, while a conditional like {% if "foo"|length %} will evaluate to true because the length filter will return 3 characters and 3 is a "truthy" value.

That being said, the reason why the |length filter isn't neccessary in the above example conditional is simply because Twig will automatically evaluate conditionals testing empty strings to false. So while {% if entry.dropdownFieldHandle|length %} would also work (i.e. evaluate to false for empty values), it isn't actually neccessary.

Finally, is not (or simply not) is simply Twig-speak for the != operator, i.e. is not equal to. So if you wanted to reverse the conditional above, here's how that would look:

{% if not entry.dropdownFieldHandle %}
    I have no value in the dropdown
{% else %}
    I have a value: {{ entry.dropdownFieldHandle }}
{% endif %}