Tutorialsteacher

Follow Us

Articles
  • C#
  • C# OOP
  • ASP.NET Core
  • ASP.NET MVC
  • LINQ
  • Inversion of Control (IoC)
  • Web API
  • JavaScript
  • TypeScript
  • jQuery
  • Angular 11
  • Node.js
  • D3.js
  • Sass
  • Python
  • Go lang
  • HTTPS (SSL)
  • Regex
  • SQL
  • SQL Server
  • PostgreSQL
  • MongoDB
  • Sass - Get Started
  • What is Sass
  • Sass - Setup Environment
  • Sass - Syntax
  • Sass - Variable
  • Sass - Script
  • Sass - Data Types
  • Sass - Operators
  • Sass - Functions
  • String Functions
  • Numeric Functions
  • List Functions
  • Map Functions
  • Selector Functions
  • Introspection Functions
  • Color Functions
  • Control Directives
  • Import Files and Partials
  • Sass - Mixins
  • Sass - Inheritance
Entity Framework Extensions - Boost EF Core 9
  Bulk Insert
  Bulk Delete
  Bulk Update
  Bulk Merge

Sass - List Functions

The Sass list functions allow you to interrogate, manipulate and combine lists in expected ways. The lists can be specified using any of the options described in the SassScript chapter, but you'll need to surround them with parentheses to make it clear that the list is a single argument.

Sass lists are immutable (they cannot be changed). So all of the list functions that return a list, join() for example, return a new list. They do not alter the original list.

Like the string functions, the only tricky thing about Sass lists are that they are one-based rather than zero-based. (See the nth() function in the table for an example).

FunctionDescriptionExamplesResult
length($list)Returns the number of elements in a listlength(1 2 3)3
nth($list, $n)Returns the nth element in a listnth(1 2 3, 2)2
set-nth($list, $n, $value)Sets the nth element in a list to the value suppliedset-nth(1 2 3, 2, 5)(1 5 3)
join($list1, $list2, [$separator])Appends $list2 to the end of $list1. The $separator argument can contain the values comma, space or auto. The auto value, which is the default, will use the separator in the first list.join(1 2 3, 4 5 6)(1 2 3 4 5 6)
join((1, 2, 3), (4 5 6), auto)(1, 2, 3, 4, 5, 6)
join((1, 2, 3), (4 5 6), space)(1 2 3 4 5 6)
append($list1, $val, [$separator])Appends a single value to the end of a list. If a $separator argument is provided (the default is auto), the entire list the function returns will use that separatorappend((1, 2, 3), 4)(1, 2, 3, 4)
append((1, 2, 3), 4, space)(1 2 3 4)
zip($lists)Interleaves the values of the lists provided into a single multi-dimensional listzip((red, green, blue), (10px, 15px, 5px))((#ff0000 10px), (#00ff00 15px), (#0000ff 5px))
index($list, $value)Returns the element at the index position specified by $valueindex((1 2 3), 2)2
list-separator($list)Returns the name of the separator used in a list as a stringlist-separator((1, 2, 3))"comma"
list-separator((1 2 3))"space
TUTORIALSTEACHER.COM

TutorialsTeacher.com is your authoritative source for comprehensive technologies tutorials, tailored to guide you through mastering various web and other technologies through a step-by-step approach.

Our content helps you to learn technologies easily and quickly for learners of all levels. By accessing this platform, you acknowledge that you have reviewed and consented to abide by our Terms of Use and Privacy Policy, designed to safeguard your experience and privacy rights.

[email protected]

ABOUT USTERMS OF USEPRIVACY POLICY
copywrite-symbol

2024 TutorialsTeacher.com. (v 1.2) All Rights Reserved.