Hrast BASIC-4X Discussion



#8

As asked by J-F, I am creating this thread about the BASIC interpreter for HP-48/49 I am currently working on. We can discuss specifications (after I'll have them fixed), ask questions, provide benchmarks etc.

Quote:
doesn't allow identifier after NEXT (so, NEXT always closes the inner FOR and FOR/NEXT crossing isn't possible).

So how do you exit a for loop early????

- Pauli


I must admit that I don't understand your question. How does variable after NEXT help you to exit a FOR loop early?

For example, we have the following program:

10 FOR I=1 TO 10
20 DISP I
30 NEXT I
40 DISP "I am out!"

How does NEXT I enable a premature exit, compared to NEXT only?

Couldn't you write I=10: GOTO 30 to exit the loop, no matter of NEXT vs. NEXT I?

10 FOR I=1 TO 10
15 IF I=6 THEN I=10: GOTO 30
20 DISP I
30 NEXT
40 DISP "I am out!"

Of course, BASIC-4X, being a highly structured language, provides EXIT and EXIT FOR statements for such purpose:

FOR I=1 TO 10
IF I=6 THEN EXIT
DISP I
NEXT
DISP "I am out!"

#9

Hrast,

Anyway you can setup a PayPal account so that we can purchase the various software you are selling? Sending money through Western Union has a bad taste because of all the scams on the *other auction* site!!

Namir

PS: Your music shows that you are also talented in that area as well as programming.


#10

I second this. My bank goes a little insane every time I send money via Western Union.

#11

Quote:
PS: Your music shows that you are also talented in that area as well as programming.

Thanks Namir! The problem is to find time to do all this, because of other "trivial" activities like work etc. Time is my biggest enemy :-(

In regard to PayPal/Western Union ... When I started with emulators, there wasn't even a sign of PayPal here and last time I checked it still wasn't possible to receive money via PayPal. Perhaps things changed recently, I will check it again.

#12

NEXT with a variable name is used for exiting an inner loop:

10 FOR I=5 TO 1000 STEP 2
20 FOR J=3 TO SQR(I) STEP 2
30 IF I/J = INT(I/J) THEN 60
40 NEXT
50 PRINT I;
60 NEXT I

You might well be able to do this better with your fancy structured BASIC, but this is how it was traditionally done.


#13

Eric got it first go. Being able to exit an inner loop (or two) is useful.

Many Basics pre-evaluate the loop bounds so setting the control variable to the end value didn't always work. It seems this isn't the case with yours though.


- Pauli

#14

I see. OK, I will put this feature on my TODO list. Thanks ...


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP PRIME - Need help for basic program svp. dg1969 4 1,689 10-08-2013, 04:06 PM
Last Post: dg1969
  Serious discussion regarding soft menus Tim Wessman 24 5,995 10-06-2013, 07:23 PM
Last Post: Helge Gabert
  "Best of" from HP community's discussion places Pier Aiello 4 1,795 09-12-2013, 03:05 AM
Last Post: Pier Aiello
  Easter Sunday Basic Trigs (HP-12C) Gerson W. Barbosa 29 8,475 04-04-2013, 02:19 PM
Last Post: Gerson W. Barbosa
  "The Basic HP-71" Jeff Davis 3 1,522 08-30-2012, 12:20 AM
Last Post: Howard Owen
  HP's Tired Basic Calculator Line Jeff 4 1,716 02-10-2012, 01:33 PM
Last Post: Dirk Mehldau
  A coincidence about the kilometer / mile discussion Andrés C. Rodríguez (Argentina) 0 754 10-19-2011, 08:51 AM
Last Post: Andrés C. Rodríguez (Argentina)
  OT: Hrast Programmer's Cool Music Namir 3 1,343 10-07-2011, 01:47 PM
Last Post: HrastProgrammer
  After the 15c LE, better chance of a basic RPN calc from HP now? nick lidakis 80 15,072 09-18-2011, 08:15 AM
Last Post: snaggs
  OT: Hrast Programmer's Cool Music Namir 2 1,028 08-18-2011, 08:59 AM
Last Post: Namir

Forum Jump: