June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -1,9 +1,14 @@
#assert() function takes expression as 1st argument, failed-assertion message as optional 2nd argument
julia> assert(x==42,"x is not 42")
ERROR: assertion failed: x is not 42
#@assert macro checks the supplied conditional expression, with the expression returned in the failed-assertion message
julia> @assert x==42
ERROR: assertion failed: :((x==42))
#Julia also has type assertions of the form, x::Type which can be appended to a variable for type-checking at any point
julia> x::String
ERROR: type: typeassert: expected String, got Int32
# assert() function takes expression as 1st argument, failed-assertion message
# as optional 2nd argument
assert(x == 42)
# ERROR: assertion failed: x is not 42
# @assert macro checks the supplied conditional expression, with the expression
# returned in the failed-assertion message
@assert x == 42
# ERROR: assertion failed: :((x == 42))
# Julia also has type assertions of the form, x::Type which can be appended to
# variable for type-checking at any point
x::String
# ERROR: type: typeassert: expected String, got Int32