# Take every second element of the array in Q#

Very quick question, I am trying to implement SAT solving in Q# using Grover's Algorithm. I want to take every second element from an array starting at the second element, represented with a range element : 1..2..Length(array). I am not very experienced and I am trying to find a nice and clean way to do so, without too much unnecessary for loop. Could someone help ?

• For people looking to for a specific function to do the trick : the RangeAsIntArray from the Microsoft.Quantum.Convert library will do the trick Feb 18, 2021 at 21:28

You can create an array with every second element starting from the second one using the expression array[1..2...].