Hi!
I always wondered why we need to use two “=” (or &) in an if statement but not in other situations. Like here:
if (@uv.x == 0 && @uv.y == 0)
-Olivier
Why the double "=" in if statement (if @P == 2)
3206 8 0- olivierth
- Member
- 1004 posts
- Joined: April 2017
- Offline
- Aizatulin
- Member
- 470 posts
- Joined: July 2005
- Offline
- BabaJ
- Member
- 2024 posts
- Joined: Sept. 2015
- Offline
What other situations do you mean where you don't have to use:
Single equal symbol is an assignment operation; Double equal symbols is a comparing operation.
Maybe there's some situations where the compare is only a single equal symbol? Perhaps there's some older expression contexts that allow single equal symbol to be used as a comparative operator? I think I may have seen that, if this is what your referring to.
Houdini can have different contexts for using ‘code’, and usually there are some variations in the syntax ‘requirements/limitations’.
two “=” (or &) in an if statement
Single equal symbol is an assignment operation; Double equal symbols is a comparing operation.
Maybe there's some situations where the compare is only a single equal symbol? Perhaps there's some older expression contexts that allow single equal symbol to be used as a comparative operator? I think I may have seen that, if this is what your referring to.
Houdini can have different contexts for using ‘code’, and usually there are some variations in the syntax ‘requirements/limitations’.
- jsmack
- Member
- 7658 posts
- Joined: Sept. 2011
- Online
- olivierth
- Member
- 1004 posts
- Joined: April 2017
- Offline
- toadstorm
- Member
- 359 posts
- Joined: April 2017
- Offline
- jsmack
- Member
- 7658 posts
- Joined: Sept. 2011
- Online
- malexander
- Staff
- 5151 posts
- Joined: July 2005
- Online
In C++, you've got logical operations and bitwise operations. Logical operations assume that when comparing two numbers, True is non-zero and False is zero. Bitwise operations operate per bit, or'ing or and'ing each bit against the corresponding bit in the other value. So (12 && 5) is True, while (12 & 5) is 4 (12 is 1100, 5 is 0101 and 4 is 0100). Most of the time you'll be using logical operations ( && || ^^, and, or, exclusive or) and not bitwise ones ( & | ^ ).
- olivierth
- Member
- 1004 posts
- Joined: April 2017
- Offline
-
- Quick Links