Skip to main content
17 events
when toggle format what by license comment
Aug 27, 2022 at 15:38 comment added Mark Reed The important thing here is that even in BASICS where the first index is 0, DIM A(N) leaves you with A(N) as valid element of the array. So DIM A(12) in Microsoft BASICs actually creates an array of 13 elements, A(0) through A(12). Which means you could always pretend the 0 element was not there and get code that worked either way, though it may be wasting storage space.
Aug 19, 2022 at 16:44 comment added dave @supercat : Maybe so -- I think I used HP-2000 BASIC on the UK's Open University system (my maths teacher was taking a Computer Science degree with the OU), but I can't recall the details. The oldest Dartmouth manual for BASIC 'with strings' at bitsavers is for the 4th edition and it states DIM A$() gets an array of string (p64).
Aug 19, 2022 at 15:36 comment added supercat @another-dave: I'm pretty sure that in HP-2000 BASIC, which was based on an earlier version of Dartmouth BASIC, DIM A$(11) would specify that A$ is a single string that can hold a maximum of eleven characters, and if A$ was set to GRASSHOPPER, the expression A$(5,8) would yield SHOP. Later versions of Dartmouth BASIC did things totally differently, but I think the way HP-2000 BASIC and Atari BASIC did things were both faithful to the earlier Dartmouth dialects.
Aug 19, 2022 at 15:24 comment added dave @supercat - but a string is not an array of characters in proper (Dartmouth) BASIC. That's why the CHANGE statement exists. DIM A$(5) gets you an array of 6 strings, not a single string of length 5 (or 6).
Aug 19, 2022 at 13:30 history edited Raffzahn CC BY-SA 4.0
added 5 characters in body
Aug 19, 2022 at 13:23 comment added Bavi_H Re: "compute*-" and "row and column" - I think you may have read a version with typos or OCR errors. It says "computer" and "row 0 and column 0" in this one: bitsavers.org/pdf/dartmouth/BASIC_4th_Edition_Jan68.pdf
Aug 18, 2022 at 15:46 comment added supercat For most purposes, the only effect of having arrays start at zero rather than one would be the allocation of some extra storage to hold an extra element (or row, column, etc.) Having most arrays start at zero would make an implementation compatible with most programs that expect them to start at zero or programs that expect them to start at 1. On the other hand, after DIM A$(5):A$="HELLO", code that expects strings to start at 1 would expect A$(1) to be H, while code that expects them to start at zero would expect it to be E. Having strings start at 0 would thus break a lot of code.
Aug 18, 2022 at 12:31 vote accept Maury Markowitz
Aug 18, 2022 at 11:00 history edited Raffzahn CC BY-SA 4.0
added 1 character in body
Aug 18, 2022 at 10:50 history edited Raffzahn CC BY-SA 4.0
added 39 characters in body
Aug 18, 2022 at 10:35 history edited Raffzahn CC BY-SA 4.0
added 779 characters in body
Aug 18, 2022 at 10:18 history edited Raffzahn CC BY-SA 4.0
added 779 characters in body
Aug 18, 2022 at 10:06 history edited Raffzahn CC BY-SA 4.0
added 125 characters in body
Aug 18, 2022 at 9:55 history edited Raffzahn CC BY-SA 4.0
added 125 characters in body
Aug 18, 2022 at 9:43 history edited Raffzahn CC BY-SA 4.0
added 451 characters in body
Aug 18, 2022 at 9:31 history edited Raffzahn CC BY-SA 4.0
added 138 characters in body
Aug 18, 2022 at 9:26 history answered Raffzahn CC BY-SA 4.0