Add Documentation (#13811)

* Add more Docs and runnableExamples
This commit is contained in:
Juan Carlos 2020-03-31 10:47:57 -03:00 • committed by GitHub
commit 42d2c3088e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 135 additions and 19 deletions

View file

@ -48,11 +48,17 @@ template assert*(cond: untyped, msg = "") =
## The compiler may not generate any code at all for ``assert`` if it is
## advised to do so through the ``-d:danger`` or ``--assertions:off``
## `command line switches <nimc.html#compiler-usage-command-line-switches>`_.
##
## .. code-block:: nim
## static: assert 1 == 9, "This works when not built with -d:danger or --assertions:off"
const expr = astToStr(cond)
assertImpl(cond, msg, expr, compileOption("assertions"))
template doAssert*(cond: untyped, msg = "") =
## Similar to ``assert`` but is always turned on regardless of ``--assertions``.
##
## .. code-block:: nim
## static: assert 1 == 9, "This works when built with/without -d:danger or --assertions:off"
const expr = astToStr(cond)
assertImpl(cond, msg, expr, true)