Thread: operators
View Single Post
  #4  
Old 11-05-2006, 06:38 PM
Chompy Chompy is offline
¯\(º_o)/¯
Chompy's Avatar
Join Date: Sep 2006
Location: Norway
Posts: 2,815
Chompy is just really niceChompy is just really niceChompy is just really nice
Send a message via MSN to Chompy
Quote:
Originally Posted by Skyld View Post
= is for assignment (in other words, for setting a variable). == is for comparison (so it doesn't do any setting, just checking for equality).
hmm, so
PHP Code:
if (foo bar) {
would assign bar too foo?

if (
foo == bar) {
would be to check if foo is equal to bar
think I got it, if that was that I just understood now

Quote:
Originally Posted by Stefan View Post
Shift, Invert and Xor are bit-operators. Graal handles all numbers internally as floating point values, but those operators are still interesting for some purposes. Integer numbers can be represented as fields of 32 bits, the first bit stands for 1, the second for 2, the third for 4, the fourth for 8 etc. Example: 10 is 8 + 2, so the bit representation is 1010 (we start reading from the right, the fields stand for 8421). Invert is inverting the bits, shift is moving the bits to the right or to the left (which is basicly multiplying with 2 or dividing by 2), and xor is combining two bit fields and the bits in the result are set when the bits of the two operands are unequal.
Hmm, I didn't understand fully all of that, but do you think
you can show some examples on how they work?
I would love to know those bit-operators, and how to use them
properly in a script
__________________
Reply With Quote