Skip to content

What's wrong with this example #20239

Discussion options

You must be logged in to vote

The problem is that that example is 4 years old... badly outdated, compared to current V.

The simplest working replacement is:

import os

fn main() {
        path := 'file.txt'
        text := 'Full text description.'

        os.write_file(path, text) or {
                println('Failed while creating file')
                return
        }

        content_lines := os.read_lines(path)!
        println(content_lines)
}

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by LukyGuyLucky
Comment options

You must be logged in to vote
1 reply
@LukyGuyLucky
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants