November 2017
Beginner
316 pages
6h 40m
English
Imagine that we have been given a task to create patterns. This is very simple, yet it makes use of all our knowledge gained so far about the for construct.
julia> for i in 1:5
for j in 1:i
print("*")
end
println("")
end
*
**
***
****
*****
Notice how we have carefully used the print() and println() functions to our advantage. The difference is that print does not changes the line, while println will use up a complete line.
julia> for i in 5:-1:1 for j in 1:i print("*") end println("") ...Read now
Unlock full access