how exactly do I use `assert()`? `assert(1 == 1, ...
# getting-started
o
how exactly do I use
assert()
?
assert(1 == 1, { "Equal" })
shows nothing in the console
where do I check the status of this flag?
y
It's the exact opposite actually. Assert prints the message when the condition is
false
o
ah, excuse me I can’t read
ok so just tried again,
Copy code
assert(1 == 2, {"not true"})
nothing printed still
z
The docs: Throws an AssertionError calculated by lazyMessage if the value is false and runtime assertions have been enabled on the JVM using the -ea JVM option.
👍🏻 1
e
Kotlin's assert is missing Java features too: https://youtrack.jetbrains.com/issue/KT-22292
o
yea was just testing it, not looking to rely on it for anything serious at the moment
e
given that, might as well use `check`/`require` (or their `*`NotNull shortcuts)