Skip to content

Commit b4b75f0

Browse files
[docs] Add an example of doing str = readline() to read a single line in from stdin (#43635)
Co-authored-by: Dilum Aluthge <[email protected]>
1 parent ae55fb2 commit b4b75f0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

base/io.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,14 @@ julia> readline("my_file.txt", keep=true)
524524
525525
julia> rm("my_file.txt")
526526
```
527+
```julia-repl
528+
julia> print("Enter your name: ")
529+
Enter your name:
530+
531+
julia> your_name = readline()
532+
Logan
533+
"Logan"
534+
```
527535
"""
528536
function readline(filename::AbstractString; keep::Bool=false)
529537
open(filename) do f

0 commit comments

Comments
 (0)