variable scope question
David Bernard <[email protected]> Wed, 06 Jul 2005 22:38:13 +0200
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
If a variable is declared in a try clause (directly under the try), is
like in java, the variable is out of the scope of the catch or finally
clause ? (Note : in the user manual there is nothing about Exception
management).
It should be "nice" if try/catch/finally share the same variable scope :
e.g
// in Java
void doSomeThing() {
OutputStream out = null;
try {
out = new ....
....
} catch(IOException exc) {
...
} finally {
if (out != null) {
try {
out.close();
} catch(Exception exc) {
}
}
}
// in Nice
void doSomeThing() {
try {
var out = new ....
....
} catch(IOException exc) {
...
} finally {
if (out != null) {
try {
out.close();
} catch(Exception exc) {
}
}
}
--
--------------------------------------------------------------
David "Dwayne" Bernard Freelance Developer (Java)
mailto:[email protected]
\|/ http://dwayne.java-fan.com
--o0O @.@ O0o-------------------------------------------------
-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click