and/or/not/xor operators

Shriramana Sharma samjnaa at gmail.com
Thu May 30 04:56:39 PDT 2013


Hello. I have always loved the readability of C++'s and/or/not/xor
word-like logical operators but It doesn't seem to be available in D.
Isn't this possible in D? I tried doing:

alias && and ;
import std.stdio ;
void main () {
	writeln ( true and true ) ;
}

but I get errors:

$ dmd foo.d
foo.d(1): Error: basic type expected, not &&
foo.d(1): Error: no identifier for declarator int
foo.d(1): Error: semicolon expected to close alias declaration
foo.d(1): Error: Declaration expected, not '&&'
foo.d(7): Error: found 'and' when expecting ',

Thanks.

-- 
Shriramana Sharma ஶ்ரீரமணஶர்மா श्रीरमणशर्मा


More information about the Digitalmars-d-learn mailing list