首页 > 建站教程 > dart >  Dart编程实例 - else if正文

Dart编程实例 - else if

Dart编程实例 - else if

void main() {

   var num = 2;

   if(num > 0) {

      print("${num} is positive");

   }

   else if(num < 0) {

      print("${num} is negative");

   }

   else {

      print("${num} is neither positive nor negative");

   }

}