Code: Select all
OpenConsole()
For i.b =0 To -128 Step -1
PrintN("Wert: "+Str(i.b))
Next i
For i.b =0 To 127
PrintN("Wert: "+Str(i.b))
Next i
End
Code: Select all
OpenConsole()
For i.b =0 To -128 Step -1
PrintN("Wert: "+Str(i.b))
Next i
For i.b =0 To 127
PrintN("Wert: "+Str(i.b))
Next i
End
Code: Select all
OpenConsole()
For i =0 To -128 Step -1
PrintN("Wert: "+Str(i))
Next
For i =0 To 127
PrintN("Wert: "+Str(i))
Next
End
Simple to answer, you have changed i.b to i.l.Inner wrote:this works however.Code: Select all
OpenConsole() For i =0 To -128 Step -1 PrintN("Wert: "+Str(i)) Next For i =0 To 127 PrintN("Wert: "+Str(i)) Next End
Code: Select all
For a.b= 1 To 127
b = a & $FF
Debug b
Next a
Code: Select all
For a.b= 1 To 254
b = a & $FF
Debug b
Next a
range for a byte: -127 to +127woki wrote:Both for loops are endless:
Code: Select all
OpenConsole() For i.b =0 To -128 Step -1 PrintN("Wert: "+Str(i.b)) Next i For i.b =0 To 127 PrintN("Wert: "+Str(i.b)) Next i End
Code: Select all
For a.b= 1 To 254
b = a & $FF
Debug b
Next a
Code: Select all
For a.b= 1 To 127
b = a & $FF
Debug b
Next a
I think that a byte can range from -128 to 127. At least the following produces the result of -128:blueznl wrote:range for a byte: -127 to +127
Code: Select all
a.b = -128
debug a
No, according to the manual a byte ranges from -128 to +127. He's not out of bounds.blueznl wrote:range for a byte: -127 to +127woki wrote:Both for loops are endless:
Code: Select all
OpenConsole() For i.b =0 To -128 Step -1 PrintN("Wert: "+Str(i.b)) Next i For i.b =0 To 127 PrintN("Wert: "+Str(i.b)) Next i End
you're going out of bounds
Code: Select all
For a.b= -129 To 127
b = a & $FF
Debug b
Next a
Code: Select all
For a.b= -128 To 127
b = a & $FF
Debug b
Next a
Code: Select all
for (b = 0; b >= -128; b++)
;
Code: Select all
Init a.b = 0
|
|
Test a.b >= -128, if false: break
|
|
Decrement a.b
Jump back to Test
Code: Select all
For a.b= -128 To 127
b = a ;& $FF ; This makes 128...255...0...127 and endless
Debug b+128 ; This makes 0...255
If a=127:Break:EndIf ; This stopped endless loop
Next a