[Nice-commit] Nice NEWS,1.66,1.67
Brought to you by:
bonniot
|
From: Daniel B. <bo...@us...> - 2005-03-07 17:11:25
|
Update of /cvsroot/nice/Nice In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18310 Modified Files: NEWS Log Message: Allow value returns in void methods. We don't need to distinguish between real and "fake" (sugared) returns. Index: NEWS =================================================================== RCS file: /cvsroot/nice/Nice/NEWS,v retrieving revision 1.66 retrieving revision 1.67 diff -C2 -d -r1.66 -r1.67 *** NEWS 7 Mar 2005 10:32:10 -0000 1.66 --- NEWS 7 Mar 2005 17:10:54 -0000 1.67 *************** *** 16,19 **** --- 16,41 ---- becouse Nice will detect that "instance" is of a "sure type" after the "instance = new Foo();" assignment. + * Allow value returns in void methods. It's useful when exiting from + the method in a branch after doing a single operation. For instance, + instead of: + + void add(int x) + { + if (x == 0) + { + buffer.append("ZERO\n"); + return; + } + ... + } + + one can now more simply write: + + void add(int x) + { + if (x == 0) + return buffer.append("ZERO\n"); + ... + } -- |