如何在DART中使用赋值运算符

在本文中,我们将要解释Dart赋值运算符。

DART赋值运算符的示例

void main() {
var  a=3,b=2;

int c=6,d=5,e=3;

print("Value of b assign to a =${a=b}");
print(" a+=b: ${a+=b}"); 
print(" a*=b: ${a*=b}"); 
print(" a~/=b: ${a~/=b}"); 
print(" a/=b: ${a/=b}"); 
print(" a%=b: ${a%=b}"); 
print(" e<<=b: ${e<<=b}"); 

}

赋值运算符

我们可以使用(=)运算符进行赋值,也可以使用复合分配运算符,

下面是一些赋值运算符:

运算符说明
=用于赋值。
+=用加法赋值。
-=带减法的赋值。
*=乘法赋值。
/=分配与部门。
~/=它提供 RoundOf 值并且可以对整数进行操作。
%=带提醒的作业。
<<=右移赋值。
>>=右移赋值。
日期:2020-04-11 23:03:59 来源:oir作者:oir