Does XOJO have a keyword for setting a number base such as 0 to 7 or 0 to 4 etc?
and &b for binary:
https://documentation.xojo.com/%26b
and &h for hex:
https://documentation.xojo.com/%26h
TBH I’m not sure what it is you mean ?
Do you literally mean to specify the numeric base a number is expressed in (base 2 for binary, octal for base 8 hex for base 16, and base 10 which is the usual default) ?
Or something else ?
I was looking for a way to incrementing a number like this:
0,1,2,3,4,5,6,7,10,11,12,13,14,15,16,17, 20, 21, 22, etc.
or even better:
1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7 etc
Used to increment the day of the week and always wrapping back to 1 after 7
nothing built in that would let you define the range of a given value in a simple way
you’d need to apply modulo arithmetic yourself
or bit masking with &h07 (&b0111) or something similar
Thanks Norman. It was very easy to do with if/then or Select Case statements. I just wanted to know.
Just count with a regular integer and use (MyInteger mod 7)+1 to get a number from 1 to 7.
MyInteger = (myInteger + 1) and &h07
should do it as well
These both look like what I was searching for but what seems to give me the correct answer is:
(myInteger Mod 7) without the 1 added. 8 yields a 1, 15 yields a 1, etc.
But 7 will be 0.
If you need 1 to 7 then you will need to check if you get 0 to convert that to 7.
Your right because 8 yields a 2 if you add the +1. So your now back to adding an if/then statement. Nothing gained yet.
I am looking for 1 to 7
You can use:
https://documentation.xojo.com/api/data_types/datetime.html#datetime-dayOfWeek
What do you want to do?
In this particular case I am asking my program to look up array values of temperatures or on/off times that are associated with days of the week. If it’s day 7 and I wish to look ahead a day I want the array element number 1, not 8 or 0
What Alberto says is (from LR):
https://documentation.xojo.com/api/data_types/datetime.html#datetime-dayOfWeek
Use DateTime.DayOfWeek:
The day of the week as an integer: 1=Sunday, 7=Saturday.