M
M
Michael R.2018-06-18 10:27:00
Sass
Michael R., 2018-06-18 10:27:00

SCSS getting array values?

Greetings!
I googled the sass / scss documentation, but did not find clear answers to my questions.
Let's say we have an array:

$arrayColors: (
        white,
        black,
        green,
        red,
        orange
);

Questions 1:
1.1. How to get the last value of an array?
There is an array loop:
@each $key, $color in $arrayColors {
      .color-#{$key}
      {
        color: $breakpoint;
      }
}

Questions 2:
2.1. How to start iterating over an array from the end?
2.2. If we started iterating over the array from the end, then how can we get the first value of the array?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iBird Rose, 2018-06-18
@Mike_Ro

google things like:
1) sass length
2) sass nth
and here the reverse loop is described blog.ricardofilipe.com/post/reverse-loops-with-sass

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question