M
moondaddy
my understanding is that the max value of a byte is 255. Therefore, why
does the following code get a compile error?
byte val1 = 10;
byte val2 = 23;
byte ttl;
ttl = val1 + val2; //this line wont compile
compile error: Cannot implicitly convert type 'int' to 'byte'.
val1 + val2 = 33 which is still in the range of a byte. therefore, why do I
need to convert ttl into an int?
Thanks.
does the following code get a compile error?
byte val1 = 10;
byte val2 = 23;
byte ttl;
ttl = val1 + val2; //this line wont compile
compile error: Cannot implicitly convert type 'int' to 'byte'.
val1 + val2 = 33 which is still in the range of a byte. therefore, why do I
need to convert ttl into an int?
Thanks.