Select Case Statement (New Features)

by GJ, Saturday, January 04, 2014, 23:48 (1267 days ago)

I would love it if you could add the "Select Case" functionality to BASIC256.

Such as :

Select Case x

Case Is <= 10

Case 11 To 40

Case Else

End Select


Or the "ElseIF" statement

Such as :

If x <= 10 Then

ElseIf x <= 40 Then

ElseIf x <= 70 And x > 40 Then

ElseIf x <= 100 And x > 70 Then

Else

End If

Thanks ...

PS

I have been using Basic256 to do a small RnD simulation program. I'm very happy with Basic256. Keep up the good work.

Select Case Statement

by Jim ⌂ @, Russell, KY, Sunday, January 05, 2014, 22:19 (1266 days ago) @ GJ

Let me think on that one. The milti-line if else endif structure is implemented in the YACC/BISON script and is quite a bugger to mess with.

Jim

Select Case Statement

by Jim ⌂ @, Russell, KY, Friday, January 10, 2014, 21:56 (1261 days ago) @ GJ

I just added a case stricture to the SVN 1.0.0.8 and will be testing it, getting the errors cleaned up, and documenting over the next few days/weeks.

It should be in the next binary release (probably sometime in February).

It works like the CASE structure in an old dialect of BASIC I used many years ago. It came from the PICK/Universe database language and looks like:

for t = 1 to 10
begin case
case t < 5
print t + " is less than 5"
case t >=5 and t < 8
print t + " is between 5 and 7 inclusive"
case 1
print t + " is something else"
end case
next t

The "case 1" works like otherwise/default/else in some other case structures. Should I implement "else" as a synonym for "case 1"?

Jim

Select Case Statement

by Jim ⌂ @, Russell, KY, Tuesday, January 14, 2014, 17:48 (1257 days ago) @ Jim

I answered my own question. case (v1.0.0.9) will allow a case1 or else for the final default condition. Lust added to the docs and will be in the next binary release.

Select Case Statement

by GJ, Wednesday, January 29, 2014, 04:43 (1242 days ago) @ Jim

Thanks for adding the "Select Case ... Else" statements. Adding the "ELSE" statement will make code much easier to read and understand. I look forward to using them in the next release.

RSS Feed of thread
powered by my little forum