# Meaning of ";" in PlotlyJS

**URL:** <https://discourse.julialang.org/t/meaning-of-in-plotlyjs/61205>\
**Category:** General Usage\
**Tags:** package, plotting\
**Created:** [May 15, 2021, 4:40pm UTC](https://discourse.julialang.org/t/meaning-of-in-plotlyjs/61205 "2021-05-15T16:40:47Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oto\_Brzobohaty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oto_brzobohaty/32/10370_2.png) [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)\
**Post date:** [May 15, 2021, 4:40pm UTC](https://discourse.julialang.org/t/meaning-of-in-plotlyjs/61205/1 "2021-05-15T16:40:47Z")

</div>

I was always wondered what does “;” means in all [examples](http://juliaplots.org/PlotlyJS.jl/stable/examples/line_scatter/).

The following functions give me the same output.

```julia
using PlotlyBase

function linescatter1()
    trace1 = scatter(;x=1:4, y=[10, 15, 13, 17], mode="markers")
    trace2 = scatter(;x=2:5, y=[16, 5, 11, 9], mode="lines")
    trace3 = scatter(;x=1:4, y=[12, 9, 15, 12], mode="lines+markers")
    Plot([trace1, trace2, trace3])
end

function linescatter2()
    trace1 = scatter(x=1:4, y=[10, 15, 13, 17], mode="markers")
    trace2 = scatter(x=2:5, y=[16, 5, 11, 9], mode="lines")
    trace3 = scatter(x=1:4, y=[12, 9, 15, 12], mode="lines+markers")
    Plot([trace1, trace2, trace3])
end

```

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [May 15, 2021, 5:05pm UTC](https://discourse.julialang.org/t/meaning-of-in-plotlyjs/61205/2 "2021-05-15T17:05:30Z")

</div>

I think it’s just function syntax for keyword parameters: [Functions · The Julia Language](https://docs.julialang.org/en/v1/manual/functions/#Keyword-Arguments)  
example:

```julia
julia> function t(; x = 1, y = 2 )
       println(x,y)
       end

julia> t(x=4,y=5)
45

julia> t(;x=4,y=5)
45

```

You can omit the `; `

> When the function is called, the semicolon is optional

---

<div class="post-metadata">

**Author:** ![Oto\_Brzobohaty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oto_brzobohaty/32/10370_2.png) [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)\
**Post date:** [May 15, 2021, 5:24pm UTC](https://discourse.julialang.org/t/meaning-of-in-plotlyjs/61205/3 "2021-05-15T17:24:48Z")

</div>

I see. But why should I use it? In other words, why all examples are written with “;” in function calls?

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [May 15, 2021, 6:21pm UTC](https://discourse.julialang.org/t/meaning-of-in-plotlyjs/61205/4 "2021-05-15T18:21:51Z")

</div>

Perhaps to make it clear that these are keyword parameter? I don’t know, why is this important?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [May 15, 2021, 6:34pm UTC](https://discourse.julialang.org/t/meaning-of-in-plotlyjs/61205/5 "2021-05-15T18:34:41Z")

</div>

You don’t need it for keyword arguments, but you do need it for splatting keyword arguments.

---

<div class="post-metadata">

**Author:** ![Oto\_Brzobohaty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oto_brzobohaty/32/10370_2.png) [@Oto\_Brzobohaty](https://discourse.julialang.org/u/Oto_Brzobohaty)\
**Post date:** [May 15, 2021, 7:27pm UTC](https://discourse.julialang.org/t/meaning-of-in-plotlyjs/61205/6 "2021-05-15T19:27:10Z")

</div>

I was just looking for a reason why to use it.

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://discourse.julialang.org/u/jules)\
**Post date:** [May 15, 2021, 7:27pm UTC](https://discourse.julialang.org/t/meaning-of-in-plotlyjs/61205/7 "2021-05-15T19:27:48Z")

</div>

Oh and you also need it when defining functions with keyword arguments. And for these reasons some people just always add them so they don’t have to think about it

---

<div class="post-metadata">

**Author:** ![andenrx](https://avatars.discourse-cdn.com/v4/letter/a/7993a0/32.png) [@andenrx](https://discourse.julialang.org/u/andenrx)\
**Post date:** [May 16, 2021, 1:47am UTC](https://discourse.julialang.org/t/meaning-of-in-plotlyjs/61205/8 "2021-05-16T01:47:11Z")

</div>

Here’s two other cases where you would need to use `;`

If we define

```julia
kwargs = Dict(:x => 3, :y => 4)
foo(; x, y) = x + y # x and y are keyword arguments

```

Then you need to use

```julia
foo(; kwargs...) # equivalent to foo(; x=3, y=4)

```

Instead of

```julia
foo(kwargs...) # equivalent to foo(x => 3, y => 4)

```

Also with

```julia
bar = "baz"
foo(; bar) = println(bar)

```

Then you want

```julia
foo(; bar) # equivalent to foo(bar=bar)

```

Instead of

```julia
foo(bar)

```

Although these are fairly specific cases. In most cases you can just ignore the semicolon.
