How to use strings, integers, floats and booleans with calculation in Println with Go

1 Answer

0 votes
package main
 
import (
  "fmt"
)
 
func main() {
    fmt.Println("golang" + " " + "nodejs")
         
    fmt.Println("1) ", 12 + 98)
    fmt.Println("2) ", 3.14 + 1)
    fmt.Println("3) ", 11.0/5.0)
    fmt.Println("4) ", 4.38/2.0)
     
    fmt.Println("5) ", true || false)
    fmt.Println("6) ", true && false)
    fmt.Println("7) ", !true)
}
 
 
 
/*
     
run:
 
golang nodejs
1)  110
2)  4.14
3)  2.2
4)  2.19
5)  true
6)  false
7)  false
 
*/

 



answered Feb 20, 2020 by avibootz
edited Feb 20, 2020 by avibootz

Related questions

...