From d4222ff2b6034e7cab189b85e428906dac9aebf8 Mon Sep 17 00:00:00 2001 From: EricFromCanada Date: Mon, 22 Feb 2021 16:23:05 -0500 Subject: [PATCH] Numbers and array indices can be negative --- _basics/types.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_basics/types.md b/_basics/types.md index cd058a0..dd57044 100644 --- a/_basics/types.md +++ b/_basics/types.md @@ -30,7 +30,7 @@ Numbers include floats and integers: ```liquid {% raw %} {% assign my_int = 25 %} -{% assign my_float = 39.756 %} +{% assign my_float = -39.756 %} {% endraw %} ``` @@ -100,7 +100,7 @@ To access all the items in an array, you can loop through each item in the array ### Accessing specific items in arrays -You can use square bracket `[` `]` notation to access a specific item in an array. Array indexing starts at zero. +You can use square bracket `[` `]` notation to access a specific item in an array. Array indexing starts at zero. A negative index will count from the end of the array.

Input

```liquid @@ -108,7 +108,7 @@ You can use square bracket `[` `]` notation to access a specific item in an arra {{ site.users[0] }} {{ site.users[1] }} -{{ site.users[3] }} +{{ site.users[-1] }} {% endraw %} ```