// ========================================================================== // $Id: foo.go,v 1.2 2015/04/07 14:11:12 jlang Exp $ // CSI2120 GO: Functions // ========================================================================== // (C)opyright: // // Jochen Lang // EECS, University of Ottawa // 800 King Edward Ave. // Ottawa, On., K1N 6N5 // Canada. // http://www.eecs.uottawa.ca // // Creator: Jochen Lang (based on example by R. Laganiere) // Email: jlang@eecs.uottawa.ca // ========================================================================== // $Log: foo.go,v $ // Revision 1.2 2015/04/07 14:11:12 jlang // go fmt formatting // // Revision 1.1 2014/03/27 03:27:49 jlang // Created Go examples for intro lecture. // // ========================================================================== package main import "fmt" const pi = 3.1416 var x int = 5 // global variable func main() { var ( // grouping or "factoring the keyword" a float64 = 8.8 b float64 ) b = foo(a) fmt.Printf("Result: %f", b) } func foo(z float64) float64 { u := 3.3 // intializing declaration return u * z }