Julia Program Examples

Some of the Julia code examples discussed during the lectures are available here. Comments in each file explain the functionality and the concepts illustrated.

Basic languages elements to get started (see comments in the codes for explanations)

[int1.jl] Integer declaration and wrap-around (mod) behavior
[int2.jl] Integer declarations; modified version of int1, run-time error due to type mismatch
[randomarray.jl] Function with two methods; generates array of Float32 or Float64 random numbers
[matrix.jl] Matrices and matrix operations
[specialnames.jl] Unicode characters in variable and function names
[bool.jl] Bool data type as subset of Int type
[bitwise.jl] Bitwise boolean operations
[ifelse.jl] Illustrates if-else-elseif construct and ternary operator
[timing.jl] Use of veectorized operators and @. macro, as well as timing of code
[complex.jl] Complex numbers and operations
[unicode.jl] Illustration of Unicode characters
[string.jl] Operations on a string of Unicode characters
[catch.jl] Illustration of the try-catch mechanism
[write.jl] Writing data sets to multiple files with index
[read.jl] Reading data sets from files
[scope.jl] Illustration of scope blocks
[scoperror.jl] Illustration of soft and hard local scopes (and common error)
[struct.jl] Composite data type using struct
[module.jl][main.jl] Illustration of use of module written in separate file
[letblock.jl] Illustration of saving data internally in a let block
[quadgk.jl] Integration of a function using the QuadGK package

[codes.tar] All the above files in a tar archive