# StepRange and StepRangeLen have no common abstract class

**URL:** https://discourse.julialang.org/t/steprange-and-steprangelen-have-no-common-abstract-class/79085
**Category:** General Usage
**Created:** [April 6, 2022, 10:24am UTC](https://discourse.julialang.org/t/steprange-and-steprangelen-have-no-common-abstract-class/79085 "2022-04-06T10:24:11Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![alequa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alequa/32/12338_2.png) [@alequa](https://discourse.julialang.org/u/alequa)
#### Post date: [April 6, 2022, 10:24am UTC](https://discourse.julialang.org/t/steprange-and-steprangelen-have-no-common-abstract-class/79085/1 "2022-04-06T10:24:12Z")

</div>

Hello,

I would like to have a function like this (where I want to do something more interesting than printing):

`x = (myrange::Range) -> print(length(range))`

But I cannot find an abstract type that has both StepRange `1:2:10` and StepRangeLen `1:2.5:10`.  
It seems weird to me that I have to use the Union here.

And more in general, what is the idea behind StepRange, why does it differ so much from the version with Float (StepRangeLen) values?

Thanks

---

<div class="post-metadata">

### Author: ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)
#### Post date: [April 6, 2022, 10:31am UTC](https://discourse.julialang.org/t/steprange-and-steprangelen-have-no-common-abstract-class/79085/2 "2022-04-06T10:31:59Z")

</div>

`AbstractRange` or `AbstractVector`?

You can use `supertypes` to inspect the type hierarchy.
