## D - question: evaluations

• Lewis (13/13) Jan 14 2004 in vb anything that isnt 0 evaluates to true, is this the same in d?
• J Anderson (10/23) Jan 14 2004 Yes, it's the same in C and C++ as well. One difference is that the
• Lewis (2/40) Jan 14 2004 neato! thanks Mr. Anderson
Lewis <dethbomb hotmail.com> writes:
```in vb anything that isnt 0 evaluates to true, is this the same in d?

//example

char[] foo;
foo.length = 1;

if (foo.length) {

}

//or

uint x;
x = -1;
if (x) {  }

//or
while (x) { }

thanks
```
Jan 14 2004
```Lewis wrote:

in vb anything that isnt 0 evaluates to true, is this the same in d?

//example

char[] foo;
foo.length = 1;

if (foo.length) {

}

//or

uint x;
x = -1;
if (x) {  }

//or
while (x) { }

thanks

Yes, it's the same in C and C++ as well.  One difference is that the
literal true = 1 in these languages. In VB the literal true = -1;  It's
particularly useful for pointers, which are null (0) if they don't have
anything in them.

int* p;

if (p)
{
//There's something in p
}
```
Jan 14 2004
Lewis <dethbomb hotmail.com> writes:
```J Anderson wrote:
Lewis wrote:

in vb anything that isnt 0 evaluates to true, is this the same in d?

//example

char[] foo;
foo.length = 1;

if (foo.length) {

}

//or

uint x;
x = -1;
if (x) {  }

//or
while (x) { }

thanks

Yes, it's the same in C and C++ as well.  One difference is that the
literal true = 1 in these languages. In VB the literal true = -1;  It's
particularly useful for pointers, which are null (0) if they don't have
anything in them.

int* p;

if (p)
{
//There's something in p
}

neato! thanks Mr. Anderson
```
Jan 14 2004