www.digitalmars.com         C & C++   DMDScript  

D - Once keyword

reply "Don Stewart" <donald genient.com> writes:
Another interesting keyword I found whilst looking at Sather is the once
keyword. It is used during iteration some thing along the lines of

for ( int i = 0; i < 10, once(j != null); i++ )

where j !=null is only tested on the first evaluation, and is not checked
subequently.
May 24 2002
next sibling parent Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
Don Stewart wrote:

 Another interesting keyword I found whilst looking at Sather is the once
 keyword. It is used during iteration some thing along the lines of

 for ( int i = 0; i < 10, once(j != null); i++ )

 where j !=null is only tested on the first evaluation, and is not checked
 subequently.

So it's the same as: if(j != null) for( int i = 0; i < 10; i++ ) -- The Villagers are Online! http://villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]
May 24 2002
prev sibling parent "Sean L. Palmer" <seanpalmer earthlink.net> writes:
Just write:

if (j != null)
  for ( int i = 0; i < 10; i++ )


"Don Stewart" <donald genient.com> wrote in message
news:acln46$k12$1 digitaldaemon.com...
 Another interesting keyword I found whilst looking at Sather is the once
 keyword. It is used during iteration some thing along the lines of

 for ( int i = 0; i < 10, once(j != null); i++ )

 where j !=null is only tested on the first evaluation, and is not checked
 subequently.

May 24 2002