# « ! », « ? » And « & » in Crystal What do they mean

**URL:** <https://forum.crystal-lang.org/t/and-in-crystal-what-do-they-mean/3114>\
**Category:** Offtopic\
**Created:** [March 28, 2021, 5:53pm UTC](https://forum.crystal-lang.org/t/and-in-crystal-what-do-they-mean/3114 "2021-03-28T17:53:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![serge-hulne](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/serge-hulne/32/1211_2.png) [@serge-hulne](https://forum.crystal-lang.org/u/serge-hulne)\
**Post date:** [March 28, 2021, 5:53pm UTC](https://forum.crystal-lang.org/t/and-in-crystal-what-do-they-mean/3114/1 "2021-03-28T17:53:19Z")

</div>

Hi,

I’m familiar with some of the use of the « ! », « ? » And « & » operators in C, C++ etc…

However, in addition to their use of in C, these operators seem to have special meanings in Crystal, for instance:

- Hello()
- Hello?() (or hello?())
- Hello!() (or hello()!)

Seem to mean different things in Crystal

I have also seen « & » when methods acting on iterables are chained, something like:

MyIter.filter.&.map(my-func())

What is the use of « & » in this context?

---

<div class="post-metadata">

**Author:** ![Blacksmoke16](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/blacksmoke16/32/1241_2.png) [@Blacksmoke16](https://forum.crystal-lang.org/u/Blacksmoke16)\
**Post date:** [March 28, 2021, 7:36pm UTC](https://forum.crystal-lang.org/t/and-in-crystal-what-do-they-mean/3114/2 "2021-03-28T19:36:33Z")

</div>

`?` in crystal has a few meanings depending on context:

1. Representing a type union with `Nil`. E.g. `String?` which is equivalent to `String | Nil`.
2. A method that would return `nil`. E.g. `[1, 2, 3][5]? # => nil`
3. A method that returns a boolean. E.g. `user.active?`.

`!` on the other hand is usually used to denote a method call that either modifies self, or would raise an exception.

`&` is used mainly regarding blocks. See [Blocks and Procs - Crystal](https://crystal-lang.org/reference/syntax_and_semantics/blocks_and_procs.html#short-one-parameter-syntax).

---

<div class="post-metadata">

**Author:** ![asterite](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/asterite/32/60_2.png) [@asterite](https://forum.crystal-lang.org/u/asterite)\
**Post date:** [March 28, 2021, 10:30pm UTC](https://forum.crystal-lang.org/t/and-in-crystal-what-do-they-mean/3114/3 "2021-03-28T22:30:58Z")

</div>

Just to clarify: a question mark or a bang at the end of a method name is just part of the name. It’s like any other name. Then there are conventions about when to use these suffixes and what they mean.

---

<div class="post-metadata">

**Author:** ![serge-hulne](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/serge-hulne/32/1211_2.png) [@serge-hulne](https://forum.crystal-lang.org/u/serge-hulne)\
**Post date:** [March 28, 2021, 10:45pm UTC](https://forum.crystal-lang.org/t/and-in-crystal-what-do-they-mean/3114/4 "2021-03-28T22:45:22Z")

</div>

Tank you.
