# Nullable assigner?

**URL:** <https://discuss.kotlinlang.org/t/nullable-assigner/3931>\
**Category:** Language Design\
**Created:** [July 27, 2017, 11:21pm UTC](https://discuss.kotlinlang.org/t/nullable-assigner/3931 "2017-07-27T23:21:04Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![tieskedh](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.kotlinlang.org/tieskedh/32/2816_2.png) [@tieskedh](https://discuss.kotlinlang.org/u/tieskedh)\
**Post date:** [July 30, 2017, 1:35pm UTC](https://discuss.kotlinlang.org/t/nullable-assigner/3931/5 "2017-07-30T13:35:30Z")

</div>

The main reason why I posted this is that I found a lot of the following code samples:

```
if(a != null) a = func()
a!!.exec()

```

I wanted to refactor this, but right now I need to check four things before I can refactor:

- Is `setA` or `func` expensive?
- Does `setA` handle assigning the same variable to it well?
- Does `func` have side effects?
- Does a need to be set, before calling exec on it.

When one of these reasons is true, only the nullable assigner or where it is mapped to is possible.

I will search for founded reasons of this and then I will post it here.

---

_[View the full topic](https://discuss.kotlinlang.org/t/nullable-assigner/3931)._
