Search code examples
julia

What does double dot (..) in Julia Programming Language mean?


For example in the code below, x is defining the domain, but why is there the double dot between 0 and 4pi?

using ApproxFun
x=Fun(identity,0..4π)

Solution

  • .. is not part of Julia, rather part of the packages used by ApproxFun.

    It is used to represent intervals, see the code below

    julia> u = 1..3
    1..3
    
    julia> dump(u)
    Interval{:closed,:closed,Int64}
      left: Int64 1
      right: Int64 3
    

    So this is just a convenience constructor for the Interval object, see:

    julia> 1..3 === Interval{:closed,:closed,Int64}(1,3)
    true