当前位置:网站首页>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
边栏推荐
- Text filtering skills
- Each account corresponds to all passwords, and then each password corresponds to all accounts. How to write the brute force cracking code
- Some suggestions on Oracle SQL tuning
- Redis系列4:高可用之Sentinel(哨兵模式)
- Interesting kotlin 0x0a:fun with composition
- Understanding of asmlinkage
- Configure HyperMesh secondary development environment on vs Code
- Brother Ali teaches you how to correctly understand the problem of standard IO buffer
- Optimization of network request success rate in IM instant messaging software development
- “蔚来杯“2022牛客暑期多校训练营3 A.Ancestor LCA+暴力计数
猜你喜欢

Text filtering skills

ANSYS secondary development - MFC interface calls ADPL file

【深度学习】:《PyTorch入门到项目实战》第八天:权重衰退(含源码)

Interesting kotlin 0x09:extensions are resolved statically

排序2-冒泡排序与快速排序(递归加非递归讲解)

Call DLL file without source code

TCP handshake, waving, time wait connection reset and other records

Introduction and implementation of stack (detailed explanation)

快速掌握 Kotlin 集合函数

MySQL5.7及SQLyogV12安装及使用破解及常用命令
随机推荐
Curl returns blank or null without output. Solve the problem
"Weilai Cup" 2022 Niuke summer multi school training camp 3 h.hacker sam+ segment tree /dp/ divide and conquer (without the largest sub segment and of the inspection interval)
Ruoyi集成flyway后启动报错的解决方法
MD5加密验证
Text filtering skills
Sort 5-count sort
Best cow fences solution
【JS】1394- ES2022 的 8 个实用的新功能
Call DLL file without source code
Sort 2 bubble sort and quick sort (recursive and non recursive explanation)
Interesting kotlin 0x08:what am I
ANSA二次开发 - 界面开发工具介绍
快速掌握 Kotlin 集合函数
“蔚来杯“2022牛客暑期多校训练营3 H.Hacker SAM+线段树/DP/分治(不带修查区间最大子段和)
HyperMesh auto save (enhanced) plug-in instructions
Redis系列4:高可用之Sentinel(哨兵模式)
Each account corresponds to all passwords, and then each password corresponds to all accounts. How to write the brute force cracking code
Simple addition, deletion, modification and query of commodity information
记录开发问题
FX3开发板 及 原理图