[go: nahoru, domu]

Skip to content

Commit

Permalink
Update 37 Ternary Operators in C++ (Conditional Assignment).md
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagi-ovo committed Oct 18, 2023
1 parent 86e4579 commit d02e1df
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## 1. 一般使用
```cpp
if (s_Level > 5)
s_Speed = 10;
s_Speed = 10;
else
s_Speed = 5;
```
Expand Down Expand Up @@ -38,4 +38,4 @@ s_Speed = s_Level > 5 ? s_Level > 10 ? 15 : 10 : 5; // 三元运算嵌套
```cpp
s_Speed = s_Level > 5 && s_Level < 100 ? s_Level > 10 ? 15 : 10 : 5;
```
越来越疯狂了,不用多想,没太多意义,尽量不要这么写。
越来越疯狂了,不用多想,没太多意义,尽量不要这么写。

0 comments on commit d02e1df

Please sign in to comment.