When do controllers assign a squawk code to VFR aircraft in Canada? In all of my previous flying experience the controllers provided a squawk code only when I requested flight following. On a recent flight from Buttonville, Ontario (CYKZ), the controller provided a squawk code on the ground. I asked if she was providing a squawk code because she was going to provide flight following as well. She said the flight following will need to be requested after she hands me off to Toronto City Center.

Then why was the squawk code provided? Was the controller anticipating the need for a squawk code? Are all airports in the Toronto region required to provide squawk codes to departing flights?
The controller will assign you a squawk code if they want to differentiate your radar return from other aircraft. It has nothing to do with whether you're getting flight following or not. If they're happy they know which blip is you for the length of time that they'll be watching you, then they may not give you a squawk. In some airspace, the moment you begin talking to them then they'll give you a squawk. All depends.