# What is this empty! function in Julia?

**URL:** https://discourse.julialang.org/t/what-is-this-empty-function-in-julia/26132
**Category:** General Usage
**Created:** [July 8, 2019, 10:31am UTC](https://discourse.julialang.org/t/what-is-this-empty-function-in-julia/26132 "2019-07-08T10:31:33Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![bsnyh](https://avatars.discourse-cdn.com/v4/letter/b/ce7236/32.png) [@bsnyh](https://discourse.julialang.org/u/bsnyh)
#### Post date: [July 8, 2019, 10:31am UTC](https://discourse.julialang.org/t/what-is-this-empty-function-in-julia/26132/1 "2019-07-08T10:31:33Z")

</div>

Hi, the following is the code, excepted from OpenStreetMap package. This interesting empty! function confuses me.

```julia
type OSMattributes
    oneway::Bool
    oneway_override::Bool
    oneway_reverse::Bool
    visible::Bool
    lanes::Int

    name::UTF8String
    class::UTF8String
    detail::UTF8String
    cycleway::UTF8String
    sidewalk::UTF8String
    bicycle::UTF8String

    # XML elements
    element::Symbol # :None, :Node, :Way, :Tag[, :Relation]
    parent::Symbol # :Building, :Feature, :Highway
    way_nodes::Vector{Int} # for buildings and highways

    id::Int # Uninitialized
    lat::Float64 # Uninitialized
    lon::Float64 # Uninitialized

    OSMattributes() = new(false,false,false,false,1,
                          "","","","","","",:None,:None,[])
end

function reset_attributes!(osm::OSMattributes)
    osm.oneway = osm.oneway_override = osm.oneway_reverse = osm.visible = false
    osm.lanes = 1
    osm.name = osm.class = osm.detail = osm.cycleway = osm.sidewalk = osm.bicycle = ""
    osm.element = osm.parent = :None
    empty!(osm.way_nodes) # <--- confused
end

```

I can not find any documentation about this function. Is it because it is deprecated? Any comments are greatly appreciated.

---

<div class="post-metadata">

### Author: ![mohamed82008](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mohamed82008/32/18171_2.png) [@mohamed82008](https://discourse.julialang.org/u/mohamed82008)
#### Post date: [July 8, 2019, 10:38am UTC](https://discourse.julialang.org/t/what-is-this-empty-function-in-julia/26132/2 "2019-07-08T10:38:37Z")

</div>

Type `?empty!` in REPL for the docs.

---

<div class="post-metadata">

### Author: ![tamasgal](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamasgal/32/27946_2.png) [@tamasgal](https://discourse.julialang.org/u/tamasgal)
#### Post date: [July 8, 2019, 11:09am UTC](https://discourse.julialang.org/t/what-is-this-empty-function-in-julia/26132/3 "2019-07-08T11:09:50Z")

</div>

For the sake of completeness 😉

```julia
help?> empty!
search: empty! empty isempty

  empty!(collection) -> collection

  Remove all elements from a collection.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> A = Dict("a" => 1, "b" => 2)
  Dict{String,Int64} with 2 entries:
    "b" => 2
    "a" => 1

  julia> empty!(A);

  julia> A
  Dict{String,Int64} with 0 entries

```
