Tutorial by Examples

The STDIN stream in Julia refers to standard input. This can represent either user input, for interactive command-line programs, or input from a file or pipeline that has been redirected into the program. The readline function, when not provided any arguments, will read data from STDIN until a newl...
Reading numbers from standard input is a combination of reading strings and parsing such strings as numbers. The parse function is used to parse a string into the desired number type: julia> parse(Int, "17") 17 julia> parse(Float32, "-3e6") -3.0f6 The format expec...
Reading strings or bytes Files can be opened for reading using the open function, which is often used together with do block syntax: open("myfile") do f for (i, line) in enumerate(eachline(f)) print("Line $i: $line") end end Suppose myfile exists and its ...

Page 1 of 1