## digitalmars.D.learn - ~ ?

• pgtkda (2/2) Jun 26 2014 What does this symbol mean in relation to D?
```What does this symbol mean in relation to D?

~
```
Jun 26 2014
```On 06/26/2014 10:58 PM, pgtkda wrote:
What does this symbol mean in relation to D?

~

It can be used in two ways:

1) When used as a unary operator, it means bitwise complement:

assert(~0xaa55aa55 == 0x55aa55aa);

2) When used as a binary operator, it means concatenation:

assert("hello" ~ " world" == "hello world");

auto arr = [ 1, 2 ];
assert(arr ~ 3 == [ 1, 2, 3 ]);

When used with assignment, it means appending:

auto arr = [ 1, 2 ];
arr ~= 3;

assert(arr == [ 1, 2, 3 ]);

It can also be used in the special function name ~this(), which is the
destructor of a struct or a class. (Related functions: 'static ~this()'
and 'shared static ~this()')

Ali

 http://ddili.org/ders/d.en/bit_operations.html

 http://ddili.org/ders/d.en/arrays.html

 ddili.org/ders/d.en/special_functions.html
```
Jun 26 2014
```On Friday, 27 June 2014 at 06:33:07 UTC, Ali Çehreli wrote:
On 06/26/2014 10:58 PM, pgtkda wrote:
What does this symbol mean in relation to D?

~

It can be used in two ways:

1) When used as a unary operator, it means bitwise complement:

assert(~0xaa55aa55 == 0x55aa55aa);

2) When used as a binary operator, it means concatenation:

assert("hello" ~ " world" == "hello world");

auto arr = [ 1, 2 ];
assert(arr ~ 3 == [ 1, 2, 3 ]);

When used with assignment, it means appending:

auto arr = [ 1, 2 ];
arr ~= 3;

assert(arr == [ 1, 2, 3 ]);

It can also be used in the special function name ~this(), which
is the destructor of a struct or a class. (Related functions:
'static ~this()' and 'shared static ~this()')

Ali

 http://ddili.org/ders/d.en/bit_operations.html

 http://ddili.org/ders/d.en/arrays.html

 ddili.org/ders/d.en/special_functions.html

Thanks :)
```
Jun 26 2014    "Chris" <wendlec tcd.ie> writes:
```On Friday, 27 June 2014 at 05:58:14 UTC, pgtkda wrote:
What does this symbol mean in relation to D?

~

~ D means it's about the best language I've come across so far.
```
Jun 27 2014