# Null check in do while loop

**URL:** <https://discuss.kotlinlang.org/t/null-check-in-do-while-loop/18443>\
**Category:** Language Design\
**Created:** [July 14, 2020, 12:59pm UTC](https://discuss.kotlinlang.org/t/null-check-in-do-while-loop/18443 "2020-07-14T12:59:03Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![al3c](https://avatars.discourse-cdn.com/v4/letter/a/e47774/32.png) [@al3c](https://discuss.kotlinlang.org/u/al3c)\
**Post date:** [July 14, 2020, 1:24pm UTC](https://discuss.kotlinlang.org/t/null-check-in-do-while-loop/18443/2 "2020-07-14T13:24:44Z")

</div>

This has been discussed a number of times in very long and somewhat heated threads ([Smart casts and nullability in single-threaded contexts - #11 by mslenc](https://discuss.kotlinlang.org/t/smart-casts-and-nullability-in-single-threaded-contexts/4562/11)).

Fundamentally the compiler can’t be sure that `abc` won’t be null when you read it. (you can add an instruction in between changing `abc` or there might another thread changing it).

---

_[View the full topic](https://discuss.kotlinlang.org/t/null-check-in-do-while-loop/18443)._
