Created
November 26, 2018 20:38
-
-
Save kiramishima/25e70990d8b995c2e2cf1292460d18f4 to your computer and use it in GitHub Desktop.
Ejemplo de Variables Compartidas
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mi-proyecto/main.go | |
package main | |
import "mi-proyecto/rutas" | |
import "mi-proyecto/rutas/software" | |
func main() { | |
rutas.Saludar() | |
software.Saludar2() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mi-proyecto/rutas/main.go | |
package rutas | |
import "fmt" | |
const Nombre = "Akko" | |
var Nombre2 = "Kira" | |
// Saludar | |
func Saludar() { | |
fmt.Printf("Hola, %v\n", Nombre) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mi-proyecto/rutas/software/main.go | |
package software | |
import ( | |
"fmt" | |
"mi-proyecto/rutas" | |
) | |
// Saludar2 | |
func Saludar2() { | |
fmt.Printf("Hola desde Software, %v\n", rutas.Nombre) | |
fmt.Printf("Hola desde Software, %v\n", rutas.Nombre2) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment