D语言逻辑运算符

import std.stdio;

int main(string[] args) {
   int a = 5;
   int b = 20;
   int c ;

   if ( a && b ) {
      writefln(Line 1 - Condition is true\n );
   }
   if ( a || b ) {
      writefln(Line 2 - Condition is true\n );
   }
   /* lets change the value of a and b */

   a = 0; 
   b = 10; 

   if ( a && b ) { 
      writefln(Line 3 - Condition is true\n ); 
   } else { 
      writefln(Line 3 - Condition is not true\n ); 
   } 

   if ( !(a && b) ) { 
      writefln(Line 4 - Condition is true\n ); 
   } 
   return 0;
}

相关文章

// ------------------- import std.stdio; void main(str...
import std.stdio; int main () { /* local variable defi...
import std.stdio; int main(string[] args) { int a = 20...
import std.stdio; int main(string[] args) { int a = 4;...
import std.stdio; int main(string[] args) { int a = 21;...
import std.stdio; int main(string[] args) { uint a = 60...