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
package main | |
import "fmt" | |
type Perishable string | |
func main(){ | |
tomatoes := newPerishable("Tomatoes") | |
fmt.Println("Before freezing: ",tomatoes) | |
frozen := tomatoes.freeze() |
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
package main | |
import "fmt" | |
func main() { | |
card := newCard() | |
fmt.Println(card) | |
} | |
func newCard() string { |
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
package main | |
import "fmt" | |
func main() { | |
var childrenNames [3]string | |
cards := []string{"Ace of Diamonds", newCard()} | |
cards = append(cards, "Six of Spades") | |
for i, card := range cards { | |
fmt.Println(i, card) |
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
package main | |
import "fmt" | |
func main() { | |
var cardiB string = "Ace of Spades" | |
card := "Ace of Spades" | |
card = "Card of Diamonds" | |
fmt.Println(cardiB) | |
fmt.Println(card) |
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
package main | |
func main(){ | |
fmt.Println("Yo!") | |
} |