Last function

Unfortunately == allows comparing objects with different types, so you are accidentally comparing the Char 'd' to the String "d".

julia> last("abcd") == 'd'
true

You can get the string version by passing 1 to last.

julia> last("abcd",1) == "d"
true
3 Likes