November 2017
Beginner
316 pages
6h 40m
English
In Julia, apart from the regular Boolean operators, such as true and false, we also have && and ||.
The idea behind them is fairly simple:
Looking at the var1 && var2 expression, var2 only gets executed if var1 evaluates to true
Looking at the var1 || var2 expression, var2 only gets evaluated if var1 evaluates to false
To get a better understanding of the two, let's have a look at some code:
julia> isdigit("10") && println("Reached me!")
Reached me!
julia> isdigit("Ten") && println("Reached me!")
false
julia> isdigit("Ten") || println("Reached me!")
Reached me!
julia> isdigit("Ten") && println("Reached me!")
false
In the first line of code, the isdigit("10") function takes in a string value and checks whether ...
Read now
Unlock full access