Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
/* Edit type 1 */
if (msg[0] == "edit") /* Checks if msg = edit */
if (admin.Contains(m.GetString(1))) /* checks to see if added to admins
con.Send("say", "/giveedit " + msg[1]); /* gives edit to the called player */
/* Edit type 2 */
if (msg[0] == "edit") /* Checks if msg = edit */
{
if (admin.Contains(m.GetString(1))) /* checks to see if added to admins list */
{
con.Send("say", "/giveedit " + msg[1]); /* gives edit to the called player */
}
}
What's the difference between these if any and why do some people put brackets and some don't? Can it bother future code? Is there really any specifc way to do it? Does one look better or something? I really never understood the fact why some people code like example: "Edit type 1" then they do in: "Edit type 2"
Not only that but it bothers some people when they don't read code the same way they code it.. [hope that made sense. ]
Offline
Both are fine. It's up to the user.
I don't use brackets unless I need to use multiple lines.
Thanks to: Ernesdo (Current Avatar), Zoey2070 (Signature)
Very inactive, maybe in the future, idk.
Offline
You always have to use brackets when you're isolating multiple instructions. It's called a block of code.
On the other hand if you have a single instruction you often don't need to write brackets.
Some code-styling guides recommend not to put brackets if there's only one instruction, other specify to always do.
It's just a matter of esthetics.
Everybody edits, but some edit more than others
Offline
if (msg[0] == "edit" && admin.Contains(m.GetString(1))) con.Send("say", "/giveedit " + msg[1]);
Yea boi.
I never use 1. Reminds me too much of languages that use tabbing instead of braces, and I hate em.
One bot to rule them all, one bot to find them. One bot to bring them all... and with this cliché blind them.
Offline
[ Started around 1732693894.3052 - Generated in 0.169 seconds, 15 queries executed - Memory usage: 1.42 MiB (Peak: 1.54 MiB) ]