Can someone please explain to me what's the difference between * and *= ? Because it really doesn't make any logical sense to me.
Like if * is multiplying stuff, it's like 2*2=4. That's fine but equals is what it equals to. So if you are gonna make something be equal than what is the purpose of * sign you are already equaling it. So one cancels the other. It's literally like saying something +- something else. I mean which one is it, is it plus or is it minus? Right? Doesn't make sense.
Thank you.
What is *=?
1937 5 0- Nikodim Fomich
- Member
- 67 posts
- Joined: Nov. 2017
- Offline
- asm
- Member
- 31 posts
- Joined: May 2018
- Offline
- Nikodim Fomich
- Member
- 67 posts
- Joined: Nov. 2017
- Offline
asm
In VEX (and other programming languages) X*=Y is not a mathematical expression but a syntax, in this case a short for the mathematical expression X=X*Y.
Thank you for explaining that. I think that's the problem there is a lot of common mathematical things in coding within Houdini that works as expected but than sometimes they break their own rules sort of speak with introducing new concept that meant something else just moments ago in the same node.
So instead of X and Y is there an example that would better paint the picture?
Is this numerogical thing or attribute thing?
Like @P.y*=2 means Take a Position in "y" and multiply it by 2 ? That's what it is right?
Because @P.y in this case is our "X" and 2 is our "Y". So then X = X*Y would be just that, take y position and multiply it by 2.
Which we really are just saying we want @P.y * 2; so instead of saying @P.y = @P.y *2; we do *=. Is that correct?
Edited by Nikodim Fomich - Aug. 6, 2021 17:11:02
- asm
- Member
- 31 posts
- Joined: May 2018
- Offline
- antc
- Member
- 282 posts
- Joined: Nov. 2013
- Offline
Nikodim FomichNeither, its a syntax thing that most programming languages follow.
Is this numerogical thing or attribute thing?
This might help:
https://press.rebus.community/programmingfundamentals/chapter/arithmetic-operators/
The idea being it's slightly faster and clearer to read if the variable getting assigned to doesn't appear twice in the expression.
Edited by antc - Aug. 6, 2021 19:21:23
- Nikodim Fomich
- Member
- 67 posts
- Joined: Nov. 2017
- Offline
-
- Quick Links