Code question - Use of //
MichelB
Posts: 154
Hi specialists of code. In NewDistanceFollowingWithAverageAndDeadband.bs2 (Andy Lindsay) we can find:
...
Elements·· CON·· 4
...
'
{ Subroutine - Get IR Distances }
Get_IR_Distances:
index = index + 1
index = index // Elements (or index = index // 4)
If it was a beginner writting the 2 last lines how it should be?
Something with IF... THEN, ENDIF, but what?
Thank you.
Best regards
...
Elements·· CON·· 4
...
'
{ Subroutine - Get IR Distances }
Get_IR_Distances:
index = index + 1
index = index // Elements (or index = index // 4)
If it was a beginner writting the 2 last lines how it should be?
Something with IF... THEN, ENDIF, but what?
Thank you.
Best regards
Comments
This has the effect of index "wrapping around" at Elements. It's not exactly the same, but these two statements could be rewritten as: