mirror of
https://github.com/bootdotdev/fcc-learn-golang-assets.git
synced 2025-12-15 09:41:17 +00:00
first
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
// declare here
|
||||
|
||||
fmt.Println(averageOpenRate, displayMessage)
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
// declare here
|
||||
averageOpenRate, displayMessage := .23, "is the average open rate of your messages"
|
||||
fmt.Println(averageOpenRate, displayMessage)
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
0.23 is the average open rate of your messages
|
||||
@@ -0,0 +1,17 @@
|
||||
# Same Line Declarations
|
||||
|
||||
We are able to declare multiple variables on the same line:
|
||||
|
||||
```go
|
||||
mileage, company := 80276, "Tesla"
|
||||
|
||||
// is the same as
|
||||
|
||||
mileage := 80276
|
||||
company := "Tesla"
|
||||
```
|
||||
## Assignment
|
||||
|
||||
Within the main function, declare a float called `averageOpenRate` and string called `displayMessage` on the same line.
|
||||
|
||||
Initialize them to values of `.23` and `is the average open rate of your messages` respectively before they are printed.
|
||||
Reference in New Issue
Block a user