Fazeleh
Fazeleh

Reputation: 1128

What does an exclamation mark mean after the name of a function?

I saw a function like this

function operator!(c::Matrix, out::Matrix)
    ......
end

What does ! mean here?

Upvotes: 55

Views: 22196

Answers (1)

Gnimuc
Gnimuc

Reputation: 8566

In Julia, it's a convention to append ! to names of functions that modify their arguments. The reason is Julia function arguments are passed-by-sharing, without this "bang" convention, it's not easy to know whether a function will change the content of input arguments or not.

Upvotes: 74

Related Questions