当前位置:网站首页>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
边栏推荐
- ABAQUS GUI interface solves the problem of Chinese garbled code (plug-in Chinese garbled code is also applicable)
- 微软:Edge 浏览器已内置磁盘缓存压缩技术,可节省空间占用且不降低系统性能
- How to set ticdc synchronization data to only synchronize the specified library?
- 信号屏蔽与处理
- 大学生参加六星教育PHP培训,找到了薪水远超同龄人的工作
- "Wei Lai Cup" 2022 Niuke summer multi school training camp 3 j.journey 0-1 shortest path
- LwIP develops | socket | TCP | keepalive heartbeat mechanism
- MySQL CDC if the binlog log file is incomplete, can you read all the data in the full volume stage
- 有趣的 Kotlin 0x09:Extensions are resolved statically
- 排序5-计数排序
猜你喜欢

Ansa secondary development - build ansa secondary development environment on Visual Studio code

MySQL5.7及SQLyogV12安装及使用破解及常用命令

Interesting kotlin 0x0a:fun with composition

Kubeedge releases white paper on cloud native edge computing threat model and security protection technology

排序5-计数排序

Learn ABAQUS script programming script in an hour

Interesting kotlin 0x09:extensions are resolved statically

Configure HyperMesh secondary development environment on vs Code

USB产品(FX3、CCG3PA)的调试方法

ANSYS secondary development - MFC interface calls ADPL file
随机推荐
Best Cow Fences 题解
Introduction and implementation of stack (detailed explanation)
Analysis of echo service model in the first six chapters of unp
Cluster construction and use of redis5
Microsoft: edge browser has built-in disk cache compression technology, which can save space and not reduce system performance
有趣的 Kotlin 0x06:List minus list
2021-04-02
[learn slam from scratch] publish the coordinate system transformation relationship to topic TF
LwIP development | socket | UDP
排序3-选择排序与归并排序(递归实现+非递归实现)
有趣的 Kotlin 0x0A:Fun with composition
Li Hongyi, machine learning 4. Deep learning
Debugging methods of USB products (fx3, ccg3pa)
"Wei Lai Cup" 2022 Niuke summer multi school training camp 3 acfhj
微软100题-天天做-第11题
小程序:获取元素节点信息
Splash (渲染JS服务)介绍安装
[pointer internal skill cultivation] character pointer + pointer array + array pointer + pointer parameter (I)
asp.net大文件分块上传断点续传demo
重置grafana登录密码为默认密码