On 16 February 2015 at 15:40, <
vlya...@gmail.com> wrote:
> How can i declare cost so that it could be used from different packages?
>
> I import my package "mypkg" from "main" :
> in "mypkg"
>
> package mypkg
>
> const MY_GLOBAL_CONST 1.0
(missing =)
> package main
> ...
> import (
> "mypkg"
> "fmt"
> )
> ..
> main () {
> Print(MY_GLOBAL_CONST)
fmt.Println(mypkg.MY_GLOBAL_CONST)
To use an imported identifier, prefix it with its package
name and a `.`.
Chris
who will not mention the way you could, but should not,
avoid doing this.
--
Chris "allusive" Dollin