Administrator
|
As long as you adhere to the defined behavior of the language, how you implement those behaviors is completely up to you. Many languages, especially more modern languages, specify that all variables will automatically be initialized to zero. This is because many programmers are sloppy and assume that they are, no matter how many times they are told that they are not. I don't believe Jack requires any such behavior, so doing what you are asking is perfectly acceptable. It is also the primary reason that older languages generally don't initialize local variables.
|