Message from @Mercury

Discord ID: 685697499255668806


2020-03-07 03:51:52 UTC  

and doing so before coding

2020-03-07 03:52:00 UTC  

Oh I meant sometimes people word things oddly

2020-03-07 03:52:14 UTC  

its probably worded in a mathematical way

2020-03-07 03:52:22 UTC  

Sometimes yeah

2020-03-07 03:52:26 UTC  

which takes some getting used to

2020-03-07 03:53:00 UTC  

And then sometimes itll write a big long story and then at the end be like oh yeah btw just multiply 2 numbers together that's all I want you to do

2020-03-07 03:53:17 UTC  

😵

2020-03-07 03:53:27 UTC  

lol that goes back to understanding it conceptually

2020-03-07 03:53:49 UTC  

a white board is your friend

2020-03-07 03:54:09 UTC  

Also there is an app on the phone I've been using and there are tests you can make and let other people take

2020-03-07 03:54:30 UTC  

Like 50% of the problems are knowing what x++ does compared to ++x

2020-03-07 03:54:45 UTC  

so entry level stuff

2020-03-07 03:55:00 UTC  

lookin into algorithm problems

2020-03-07 03:55:10 UTC  

Yeah but at the same time, whoever writes ++x is annoying

2020-03-07 03:55:16 UTC  

?

2020-03-07 03:55:18 UTC  

no

2020-03-07 03:55:28 UTC  

i prefer ++x if i have the option

2020-03-07 03:55:38 UTC  

even tho the compilier will optimize it probably

2020-03-07 03:55:40 UTC  

🤣

2020-03-07 03:56:16 UTC  

Wait what do you mean? Does compiler optimize that? They do 2 different things

2020-03-07 03:57:03 UTC  

If you don't keep the result it won't matter at all.

2020-03-07 03:57:10 UTC  

Nothing to optimize.

2020-03-07 03:57:12 UTC  

they effectively do the same thing, just what they return is different. ++x is one less instruction. a compiler may choose to take the statement x++ and optimize it to ++x if it wants.

2020-03-07 03:57:41 UTC  

Or rather, the compiler will know not to bother with the result, but the order in which in does the operation and keeps the result won't matter because it will be discarding the result.

2020-03-07 03:57:45 UTC  

Well depending how you use it

2020-03-07 03:58:16 UTC  

if it makes a difference in performance, then the compiler will often take care of it bascically

2020-03-07 03:58:56 UTC  

it might still matter on smaller embedded devices tho

2020-03-07 04:00:02 UTC  

Well I mean like if you do x+=++i that'll give you a different number that x+=i++

2020-03-07 04:00:19 UTC  

Yes, but also, don't do that.

2020-03-07 04:00:21 UTC  

if youre doing something like:
```
arr[i++] = x;
arr[++i] = x;
```
then yes, but thats because they return different things

2020-03-07 04:00:36 UTC  

but after the statement "i" will still be the same value

2020-03-07 04:00:45 UTC  

regardless of ++i or i++

2020-03-07 04:00:55 UTC  

Like, know the distinction, but to make your code readable, it's generally best to increment values and then on a totally separate line examine the variable.

2020-03-07 04:01:07 UTC  

Oh I agree

2020-03-07 04:01:07 UTC  

I suppose in some situations it might be nice.

2020-03-07 04:01:23 UTC  

and dont ever write that monstrosity you just wrote @Tromb2ch2 lol

2020-03-07 04:01:28 UTC  

But if somebody was being all like "x+=++i" just for shits and giggles I'd be annoyed.

2020-03-07 04:01:32 UTC  

But the tests on there are people doing that

2020-03-07 04:01:40 UTC  

its conceptual

2020-03-07 04:01:41 UTC  

is why

2020-03-07 04:01:44 UTC  

That's like 50% of the tests