The 'advantage' with Fortran and its ilk was that variables were numeric, and strings were strings, do if one put 'A' into a string constant, say $X, the machine would interpret that as a letter, and if it were put into a variable it would be interpreted as a number.
Repeat loops using Hexadecimal?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
-
richmond62
- Livecode Opensource Backer

- Posts: 10223
- Joined: Fri Feb 19, 2010 10:17 am
Re: Repeat loops using Hexadecimal?
Indeed.
The 'advantage' with Fortran and its ilk was that variables were numeric, and strings were strings, do if one put 'A' into a string constant, say $X, the machine would interpret that as a letter, and if it were put into a variable it would be interpreted as a number.
The 'advantage' with Fortran and its ilk was that variables were numeric, and strings were strings, do if one put 'A' into a string constant, say $X, the machine would interpret that as a letter, and if it were put into a variable it would be interpreted as a number.
Re: Repeat loops using Hexadecimal?
Richmond.
Craig
Long time since I wrote any Fortran, but are you saying Fortran would return "true" with (pseudo):and if it were put into a variable it would be interpreted as a number.
Code: Select all
REAL :: tVar
if tVar = C then answer (C-5) = 7Re: Repeat loops using Hexadecimal?
Richmond.
Are you still trying to use 0-F as a suite of integers in LC? I am sure you can create a gadget that translates those sixteen chars into numbers, and proceed from there.
No?
Or can you post an example of what you are trying to do with them?
Craig
Are you still trying to use 0-F as a suite of integers in LC? I am sure you can create a gadget that translates those sixteen chars into numbers, and proceed from there.
No?
Or can you post an example of what you are trying to do with them?
Craig
-
richmond62
- Livecode Opensource Backer

- Posts: 10223
- Joined: Fri Feb 19, 2010 10:17 am
Re: Repeat loops using Hexadecimal?
Both.
Reason lost in time.
Still interested just for fun.
Reason lost in time.
Still interested just for fun.
-
richmond62
- Livecode Opensource Backer

- Posts: 10223
- Joined: Fri Feb 19, 2010 10:17 am
Re: Repeat loops using Hexadecimal?
Here's a quick dose of pseudo-code:
That should repeat 256 times (i.e. hex 100).
Code: Select all
put 1 into CYCLE
repeat until CYCLE > 0x100
-- do something
add 1 to CYCLE
end repeatRe: Repeat loops using Hexadecimal?
This bit
It should be very straightforward to use baseConvert in the pseudocode loop you mentioned to make this real code, without bending it much.
only initialises the two values to control the loop from the hex values 0x0 and 0x30. There's no functional difference in specifying those values as decimal integers 0 and 48. Internally, the loop stores those values presumably as binary floats. Or piles of pebbles. Or whatever. The loop is not counting in hex - the output has to be constructed by creating a string from "0x0" and the value of the loop index converted to a string representation in base 16 with the appropriate syntax. That's no less "fudgy" than using LC baseConvert syntax.richmond62 wrote: ↑Mon Oct 07, 2024 4:13 pmCode: Select all
for (i=0x0; i < 0x30; i++) { print("0x0" + i.toString(16) +" = " + i) }
It should be very straightforward to use baseConvert in the pseudocode loop you mentioned to make this real code, without bending it much.
