ComenzarEmpieza gratis

Defining ranges

Ranges are an important concept in Julia, allowing you to quickly create an ordered collection of values. In this exercise, you want to generate a range of evenly-spaced points. Imagine if the spacing between each point was 1/3 - you would quickly find it hard to do this ourselves. This is where a range comes in - you can specify a start value, an optional step value, and an end value. Then, the range will automatically be generated for us.

There are two steps in the exercise below. In the first step, you will create and inspect a range with no step value specified. In the second step, you will create and inspect a second range, this time specifying a step value.

Este ejercicio forma parte del curso

Intermediate Julia

Ver curso

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Define the range in the variable x
x = ____

# Print the type of the range x
println(____(____))
Editar y ejecutar código