November 2017
Beginner
316 pages
6h 40m
English
Bool is a logical data type that is widely used. It is assigned and can be true or false:
julia> 1 > 2falsejulia> typeof(ans)Bool
Unlike other languages, 0, NULL, or empty strings are not treated as false in Julia.
Example:
julia> if 0 println("hello")end
The preceding command will throw an error:
TypeError: non-boolean (Int64) used in boolean context Stacktrace: [1] include_string(::String, ::String) at ./loading.jl:515
Read now
Unlock full access