Creating a slideshow with dots navigation
First, store your slides in a variable when you fetch them using craft.entries. Then, you can use the length property of that variable (which will be equal to the number of slides) to output your dots/navigation.

Full example:

{# Get the slides, store in variable called "slides" #}
{% set slides = craft.entries.section( 'yourSlideSection' ).limit( 3 ) %}

{% if slides %}
&lt;ul class="slideshow"&gt;

    {# Output slides, using the same "slides" variable #}
    {% for slide in slides %}
    &lt;li class="slide"&gt;[Your slide content here]&lt;/li&gt;
    {% endfor %}

    {% if craft.entries.section('handle').lightswitchHandle('1') is defined %}
    {# Output navigation, check length of "slides" variable #}
    &lt;ul class="nav"&gt;
         {% for i in 0..slides | length - 1 %}
         &lt;li data-uk-slideshow-item="{{ i }}"&gt;
              &lt;a href=""&gt;&lt;/a&gt;
         &lt;/li&gt;
         {% endfor %}
    &lt;/ul&gt;
    {% endif %}

&lt;/ul&gt;
{% endif %}


What the inner navigation loop does here, is to increment the variable i by one, each time the loop runs, until i is equal to the number of slides (slides | length). This means you'll always have exactly the same number of dots as slides. Inside the loop, the variable i is also used for the data attribute.

More on the Twig loop function here