assert is a macro with following behavior: if condition is true, program works as usual. If it is false, it immideatly stops program and gives a message about it.
It is a debug feature to help debug programs. It is actually completely deleted in release builds and hence does not incur any cost.