当前位置:网站首页>Record development issues
Record development issues
2022-07-28 16:53:00 【be faithful to one 's husband unto death】
scene :
There is a problem in writing code : For example, we need to do a login operation , Then, before this login operation, several confirmation interactions should be carried out , Several interactions must be successful , The structure of the code I wrote is as follows
bool step1();
bool step2();
bool step3();
bool step4();
bool step5();
bool step6();
bool login()
{
ret = step1();
if(!ret)
{
return ret;
}
ret = step2();
if(!ret)
{
return ret;
}
ret = step3();
if(!ret)
{
return ret;
}
ret = step4();
if(!ret)
{
return ret;
}
ret = step5();
if(!ret)
{
return ret;
}
ret = step6();
if(!ret)
{
return ret;
}
return true;
}This code structure makes people look disgusting , How to optimize the ?
bool step1();
bool step2();
bool step3();
bool step4();
bool step5();
bool step6();
bool login()
{
ret1 = step1();
ret2 = step2();
ret3 = step3();
ret4 = step4();
ret5 = step5();
ret6 = step6();
return ret1 & ret2 & ret3 & ret4 & ret5 & ret6;
}Is this optimization OK ? To express doubt
边栏推荐
- 【深度学习】:《PyTorch入门到项目实战》第八天:权重衰退(含源码)
- Li Hongyi, machine learning 4. Deep learning
- Leetcode daily practice - 160. Cross linked list
- PHP calculate coordinate distance
- 【从零开始学习SLAM】将坐标系变换关系发布到 topic tf
- 排序1-插入排序与希尔排序
- Detailed record of steps to configure web server (many references)
- Redis系列4:高可用之Sentinel(哨兵模式)
- Ansa secondary development - apps and ansa plug-in management
- Oracle table partition
猜你喜欢

Cluster construction and use of redis5

Leetcode daily practice - 160. Cross linked list

排序3-选择排序与归并排序(递归实现+非递归实现)

Optimization of network request success rate in IM instant messaging software development

小程序:scroll-view默认滑倒最下面

LeetCode每日一练 —— 160. 相交链表

Introduction and implementation of queue (detailed explanation)

Using pyqt to design gui in ABAQUS

Sort 1-insert sort and Hill sort

Interesting kotlin 0x0a:fun with composition
随机推荐
ABAQUS GUI interface solves the problem of Chinese garbled code (plug-in Chinese garbled code is also applicable)
智慧园区是未来发展的趋势吗?
微软100题-天天做-第11题
Best Cow Fences 题解
Interesting kotlin 0x08:what am I
Microsoft: edge browser has built-in disk cache compression technology, which can save space and not reduce system performance
QT designer for QT learning
2021-04-02
Best cow fences solution
Leetcode daily practice - the number of digits in the offer 56 array of the sword finger
MD5加密验证
Ansa secondary development - apps and ansa plug-in management
Sort 4-heap sort and massive TOPK problem
【深度学习】:《PyTorch入门到项目实战》第九天:Dropout实现(含源码)
Efficiency comparison of three methods for obtaining timestamp
"Wei Lai Cup" 2022 Niuke summer multi school training camp 3 a.ancestor lca+ violence count
Fx3 development board and schematic diagram
关于Bug处理的一些看法
IM即时通讯软件开发网络请求成功率的优化
Signal shielding and processing