Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
From left to right unless I know the RHS but I have to think what it will be called.
-
Hm. Evaluation order of operands can be important in programming languages.
But I'm confused as it seem the author meant mathematical equations....
Math bad! -
@IntrusionCM oor s/he just meant what part you THINKED first, however the result of writing is always the same.
If that's the case, I work from in to out. -
rox798464y@electrineer me too prefer this way but the course I took he evaluate the expression first then assign it to a variable which seems little odd to me :P
-
rox798464y@melezorus34 I'm just asking some took evaluate the expression first then assign it to variable. But some are like me first write the variable then assign value to it ;)
-
@rox79
Your example is very confusing.
I'd expect it to not work at all.
a = 1;
b = 2;
const c;
const c = a +b;
vs
const c = a + b;
?
If yes, it would be declaration before usage, which was common in (now) ancient C. -
Just to clarify: I wanted to give an example for the pattern....
Not saying that it is done like that in C.
Most languages will not like a redeclaration of a const variable let alone const override... So it's still wrong, but might be a step to an better example -
rox798464y@IntrusionCM I guess only @electrineer understand what I am trying to say. Rest are looking at code :P
-
-
@rox79 *subtle hint*: this was very hard to guess... ;)
In that case... You don't want to watch me programming
Since I usually know what I want to achieve I might be hopping from File to file changing a lot of things in random order...
The IDE mostly sits terrified in the corner screaming it makes no sense at all.
Usually I'm switching between both styles, depending on wether I'm having something in the clipboard for pasting or leaving a note to myself for later -
neither, i'm more of an "expanding expression tree" kind of guy.
i mean, i can either write the whole thing in order, or when i can't, i do something like:
1. newPosition = swipeEnd - swipeStart;
2. newPosition = (swipeEnd - swipeStart).normalized * movementDistance;
3.
//this dude gets added as class property
public float movementDistance;
//these guys are in a function way down
newPosition = transform.position + (swipeEnd - swipeStart).normalized * movementDistance;
and then i realize it's going to be teleporting me through walls because of course, so
4.
//this dude gets added as class property
public float movementDistance;
//these guys are in a function way down
float actualMovementDistance = movementDistance;
RaycastHit rh;
if(Physics.Raycast(..,..,.., out rh){
actualMovementDistance = rh.distance;
}
newPosition = transform.position + (swipeEnd - swipeStart).normalized * actualMovementDistance;
so... yeah... let's call it an "expanding expression tree" style =D -
Hazarth95124yIs there anyone who does the first?
I write it left to right, like a normal sentence
int c = a + b;
I want to be able to write it like I read it: "Integer c is going to equal a plus b"
I think about my code as if its written in a normal language... Or maybe reverse? I think of the code as if it was natural to speak in its language?
Dunno, but Im very language oriented, so left to right, top to bottom
Related Rants
What kind of developer you are? What you write first LHS or RHS while assigning values?
Step 1: a+b
Step 2 : const a = a+b;
or
Step 1: const a;
Step 2 : const a = a + b;
question
developer