gpt4 book ai didi

c++ - if else 评价

转载 作者:塔克拉玛干 更新时间:2023-11-03 08:18:37 27 4
gpt4 key购买 nike

假设我有以下语句:

    bool foo=true;
if (foo){
foo=false;
}
else{
//do stuff
}

是否会进入else条件,还是if一旦判断立即丢弃else

最佳答案

else 不会计算,因为条件只执行一次。

当您说 foo=true foo 被选中时,条件之一 中的代码就会被执行。如果 footrue,则 foo=false 完成并停止执行。

关于c++ - if else 评价,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29566797/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com