Doing things more efficient and keeping your code clean!

Prince

[ Verified Seller ]
Staff member
Trusted Seller
Joined
11 yrs. 6 mth. 26 days
Messages
5,381
Reaction score
18,380
Age
45
Wallet
11,590$
After my recent rant on using some improper coding and using excessive codes when it's not really needed, I've decided to show some you guys a few tips and tricks for making some more efficient and cleaner code. For this tutorial I will be using
Code:
Please, Log in or Register to view codes content!
Now before continuing on with this tutorial I'd like you to read through that code and just take a guess what's wrong with it. After your reading through it I want you to look at some of the big issues
There are a few different lists that could have all been brought into one single text document instead of close to 50 lines of code. Yes thats right 50 lines of code.
I love their title print statements consuming 14 "print" lines. This can easily be brought down to not as many print words.
The lack of functions in this code drives me crazy. They literally repeat so many things it's ridiculous.

Those are just 3 that I see right now. Now let me explain how you can fix all of these.

First lets start off with the over usage of print statements for a title.

This is what the current "title" looks like atm
4im7T.jpg

Over and over again. Now one of the things I'm not sure if people bother to learn is how to use multiline quoting for comments or in this case print statements. This can be done by using the triple quotes like so """code""" now these are double quotes used. Look how much cleaner this code can be.
yiOfd.jpg

Now the current lists are using everything like [bla,blasldf,sda,a,g,fg,df,g,df,g,wfg,we,g,g,2,tg,2g,2t,g2,tg,2tg,2t,g24,tg,42tg] long code short, WHY ARE YOU TYPING SO FREAKING MUCH IN THE CODE!!! This is what it looks like now before the fixing happens.
22Fbg.jpg

This is what it could look like after making it a little cleaner.
Felah.jpg

Now that we have our list we can create a function for the following piece of code thats repeated multiple times.
VxBlx.jpg

So lets get quickandeasy() going.

Code:
Please, Log in or Register to view codes content!
If you notice I just copied his coding already;) Sorry if the syntax breaks while typing this I'm doing it from my chromebook and it doesn't really have all the best apps. Now this code is not going to work, I'm just writing this to show the difference that is possible. I will most likely fix this code up and release it later on, but for now that is all. After everything is done and over the code can go from. 341 lines down to around 88, which is my current non working code.

N2QjH.jpg
 
Top Bottom