BenLauwens/ThinkJulia.jl

Errata in chapter 8.

Closed this issue · 2 comments

  • For the program in "Looping and Counting" section, global is necessary for count in for loop.
julia> word = "banana"
"banana"

julia> count = 0
0

julia> for letter in word
           if letter == 'a'
               count = count + 1
           end
       end
ERROR: UndefVarError: count not defined
Stacktrace:
 [1] top-level scope at ./REPL[20]:3 [inlined]
 [2] top-level scope at ./none:0

julia> println(count)
0
julia> word = "banana"
"banana"

julia> count = 0
0

julia> for letter in word
           if letter == 'a'
               global count = count + 1
           end
       end

julia> println(count)
3
  • Exercise 8-4. islower is deprecated. It should be islowercase.

Thanks!

Source and html doc is updated.

I would like to mention you in my book as a contributor.
If you are ok with it, can you give me your full name.
Thanks

Ben