Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tour: less confusing example in basics/7 #199

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions _content/tour/basics/named-results.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ package main

import "fmt"

func split(sum int) (x, y int) {
x = sum * 4 / 9
y = sum - x
func split(number int) (ones_digit, high_digits int) {
// both named return values are already defined as int variables
ones_digit = number % 10
high_digits = number - ones_digit
// will use named return values (ones_digit, high_digits)
return
}

Expand Down