作者motestt60279 (狐狸在做什麼)
看板C_Sharp
標題[問題] 能幫我看這小段程式碼在做什麼
時間Sat May 8 23:41:54 2010
if (how == 1) { if (str == "") { str = "0"; };all += Convert.ToDouble(str); }
else if (how == 2) { if (str == "") { str = "0"; };all -=
Convert.ToDouble(str); }
else if (how == 3) { if (str == "") { str = "1"; };all *=
Convert.ToDouble(str); }
else if (how == 4) { if (str == "") { str = "1"; };all /=
Convert.ToDouble(str); }
else if (how == 0) { if (str == "") { str = "0"; } all =
Convert.ToDouble(str); }
我一直不太清楚他在做啥 多了幾個括弧就有點不太了解
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.116.7.154
→ lastsecret:應該是做加減乘除的程式吧。how==1的時候是all+str 05/09 00:10
→ lastsecret:if(str==""){..}這串只是當str等於空值的時候給預設值 05/09 00:11
→ lastsecret:其他依此類推 05/09 00:12
推 F23ko:為什麼要加這個分號? 05/09 00:58
→ F23ko:if (str == "") { str = "0"; }; ← 05/09 00:58