The following statement declares a channel:
c : chan of int;This declares a channel named
c
that transports int
values. Channels are a reference type, so there is no associated storage following the declaration. Its value is nil
.
To initialize a channel and make it ready to send or receive data, you must use the assignment statement:
c = chan of int;