Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,895 questions

51,826 answers

573 users

How to use variables in Go

1 Answer

0 votes
package main

import (
  "fmt"
)

func main() {
  	var s1 = "golang"
    fmt.Println(s1)
	
	s2 := "variables"
    fmt.Println(s2)
	
	var a, b, c int = 23, 4, 16
	fmt.Println(a, b, c)
	
	var bl = true
    fmt.Println(bl)
	
	var i int
    fmt.Println(i)
	
	var f1, f2 float32 = 3.14, 4.897
    fmt.Println(f1, f2)
	
	var by byte = 'a'
	fmt.Println(by)
	
	var x, y = 847538573, "programming"
	fmt.Println(x, y)
}



/*
	
run:

golang
variables
23 4 16
true
0
3.14 4.897
97
847538573 programming

*/

 



answered Feb 20, 2020 by avibootz

Related questions

...