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;
}

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/265961.html

(0)
上一篇 2022年6月7日 21:34
下一篇 2022年6月7日 21:34

相关推荐

发表回复

登录后才能评论