Giter Club home page Giter Club logo

Comments (5)

diegoparra avatar diegoparra commented on August 22, 2024

comecei fazer recebendo os valores depois me liguei que era só pra retornar as paradas sem necessidade de receber nada.

https://play.golang.org/p/Ytx9ekwRWem

from aprendago.

an4kein avatar an4kein commented on August 22, 2024

https://play.golang.org/p/MalpWLgZI2s

package main

import (
	"fmt"
)

/* - Exercício:
   - Crie uma função que retorne um int
   - Crie outra função que retorne um int e uma string
   - Chame as duas funções
   - Demonstre seus resultados
*/

func return_int() int {
	return 1337
}

func return_int_and_string() (int, string) {
	return 31337, "anakein"
}

func main() {
	fmt.Println(return_int())
	fmt.Println(return_int_and_string())
}

Output

1337
31337 anakein

Program exited.

from aprendago.

alansantosmg avatar alansantosmg commented on August 22, 2024

My solution:

/*
- Exercício:
    - Crie uma função que retorne um int
    - Crie outra função que retorne um int e uma string
    - Chame as duas funções
    - Demonstre seus resultados
*/
package main

import "fmt"

func main() {

	x := 1
	y := "Uma String"

	fmt.Println(retorneUmInt(x))

	w, z := retorneUmInteUmaString(x, y)
	fmt.Println(w, z)

}

func retorneUmInt(i int) (meuInt int) {
	meuInt = i
	return

}

func retorneUmInteUmaString(x int, y string) (meuInt int, meuString string) {
	meuInt = x
	meuString = y
	return

}
```

from aprendago.

wfrsilva avatar wfrsilva commented on August 22, 2024

Cap. 13 – Exercícios: Nível #6 – 1
https://go.dev/play/p/lJDCpia5kzW

image

from aprendago.

thiagoCalazans-dev avatar thiagoCalazans-dev commented on August 22, 2024
// You can edit this code!
// Click here and start typing.
package main

import "fmt"

func main() {
	fmt.Println(x())
}

func x() int {
	return 2
}

func y() (int, string) {
	return 2, "dois"
}

from aprendago.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.