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.
This exercise is part of the course
Intermediate Julia
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Define the range in the variable x
x = ____
# Print the type of the range x
println(____(____))