Skip to content

docs: fix example code not printing properly - #28034

Open
lq259 wants to merge 1 commit into
vlang:masterfrom
lq259:patch-1
Open

docs: fix example code not printing properly#28034
lq259 wants to merge 1 commit into
vlang:masterfrom
lq259:patch-1

Conversation

@lq259

@lq259 lq259 commented Aug 5, 2026

Copy link
Copy Markdown

This code example:

fn foo() (int, int) {
return 2, 3
}

fn main() {
c, _ := foo()
print(c)
// no warning about unused variable returned by foo.
}

is supposed to print out the second returned variable from foo(), which is 3.

The issue is that it uses print() instead of println() to do so, resulting in nothing being printed to output, because a new line has not been started.
There are multiple ways to start a new line for this context, println() is easiest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant