# Question about Dot Notation and "$"

**URL:** https://discourse.julialang.org/t/question-about-dot-notation-and/76141
**Category:** New to Julia
**Tags:** question
**Created:** [February 10, 2022, 3:15am UTC](https://discourse.julialang.org/t/question-about-dot-notation-and/76141 "2022-02-10T03:15:56Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)
#### Post date: [February 10, 2022, 3:31am UTC](https://discourse.julialang.org/t/question-about-dot-notation-and/76141/2 "2022-02-10T03:31:57Z")

</div>

> [@Kuldeep](#):
>
> Q-1 What is the exact difference between options 1.1 and 1.2 ? Why does one work and other don’t ?

`@.` adds a dot to _every_ function call in the expression. In the case of 1.1, that includes the function `ones`, which isn’t what you want. We can write out what the `@.` is producing by hand like this:

```julia
P .= 1e-2 .* ones.(I, J) .* 1 # doesn't work

```

This fails because it’s trying to assign the entire output of `ones` (a `I x J` matrix) to _each_ element of `P`. Or, other words, it’s trying to do:

```julia
for i in eachindex(P)
  P[i] = 1e-2 * ones(I, J) * 1
end

```

which doesn’t work.

> [@Kuldeep](#):
>
> Q-2 What does “$” exactly do so that option 2.2 gives the relevant output?

The `$` syntax within `@.` means “don’t add a dot to this particular function call”, so:

```julia
@. 1e-2 * $ones(I, J) * 1

```

is equivalent to:

```julia
1e-2 .* ones(I, J) .* 1

```

i.e. the same as Option 1.2.

---

_[View the full topic](https://discourse.julialang.org/t/question-about-dot-notation-and/76141)._
