Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialbrent westley
1,089 Pointsi dont get it
i dont get it
1 Answer
Simon Coates
28,694 PointsA byte is 8 characters that can be one or zero. each character represents a power of 2, increasing from right to left, starting at 2 raised to the power zero. (ie. 1). I'm going to use a smaller data unit, called a nibble (4 bits).
0000 - 0 (8) + 0(4)+ 0(2) + 0(1) - so this represents 0
0001 - 0 (8) + 0(4)+ 0(2) + 1(1) - so this represents 1
0010- 0 (8) + 0(4)+ 1(2) + 0(1) - so this represents 2
0011 - 0 (8) +0(4)+ 1(2) + 1(1) - so this represents 3
0100- 0 (8) +1(4)+ 0(2) + 0(1) - so this represents 4
1111 - 1 (8) + 1(4)+ 1(2) + 1(1) - so this represents 15(the largest number you can represent with 4 bits)
A byte is just the same pattern with 8 characters. the first character is 2 to the power of seven (128), while the rightmost character is still 2 to the power or zero. Hence a byte lets you represent numbers in the 0-255 range.