jasperzhouzihe2138 jasperzhouzihe2138
  • 03-02-2018
  • Mathematics
contestada

Assigned newbits with the opposite values of oldbits if flipbits is true. ex: if oldbits = [1, 1, 0, 1] and flipbits is 1, then newbits = [0, 0, 1, 0]

Respuesta :

kaliyahbenning2
kaliyahbenning2 kaliyahbenning2
  • 05-02-2018

Franck's answer is better (using ~), but I just wanted to point out that the conditional in yours is slightly redundant. It's easy to forget that, since you already have a boolean value, you don't need to perform a comparison in your conditional. So you could have just done this...

if x x = false; else x = true; end
Answer Link

Otras preguntas

Why was nature so important to Anne Frank? (The Diary of Anne Frank) Please help!!!
Any facts on string art? I can't find any!
how do i change a trapezoid into a rectangle
In a right-angled triangle, the side opposite the right angle is unknown, how do you find out the unknown length? (Hypotenuse I think)
if f(x)=3x+7 and g(x)=2x-5 find g(f(-3))A. -26 B.-9 C. -1 D. 10
A rectangle whose perimeter is 80 m has an area of 384 m^2. Find the dimensions of the rectangle.
what is an example of a narrative poem
Identify true statements. (a) A sequence is either arithmetic or geometric. (b) An arithmetic sequence is either increasing or decreasing if common difference i
A candy distributor needs to mix a 10% fat-content chocolate with a 40% fat-content chocolate to create 100 kilograms of a 16% fat-content chocolate. How many k
A rectangle whose perimeter is 80 m has an area of 384 m^2. Find the dimensions of the rectangle.