Posts: 1,586
Threads: 59
Joined: Jul 2022
Reputation:
52
(11-07-2022, 10:20 PM)Pete Wrote: Yep, you're very much the Chatty Cathy around these parts, that's for sure. Hey, is that Cathy with a "C" or Kathy with a "K" do you suppose? Sometimes I feel like Guisewite. No I didn't like that cartoon strip but...
@Kernelpanic you will have to remove altogether the "CASE IS > 5500" and in the "CASE ELSE", test for your "VW Polo", allowing nothing else higher than 7000.
Posts: 1,002
Threads: 50
Joined: May 2022
Reputation:
27
11-07-2022, 10:36 PM
(This post was last modified: 11-07-2022, 10:36 PM by Kernelpanic.)
Quote:@Kernelpanic you will have to remove altogether the "CASE IS > 5500" and in the "CASE ELSE", test for your "VW Polo", allowing nothing else higher than 7000.
Yes, I tried that too, but I want to show the difference between Select Case and Select EveryCase.
Posts: 1,002
Threads: 50
Joined: May 2022
Reputation:
27
I've tried everything again, but it doesn't work; I noticed that with the comma also yesterday.
"Or" seems really redundant since it doesn't seem to do anything. An "And Less" would be good: Case Is > 5500.00 And Less 7000.00 - Case Is > 5500.00 And 7000.00 <
This would work in the sample program (Select Case):
Available (purchase price) up to 6100.00 -> VW Polo
Available (purchase price) up to 7100.00 -> (Case Else) Not on offer
Posts: 2,177
Threads: 222
Joined: Apr 2022
Reputation:
104
Code: (Select All) 'This would work in the sample program (Select Case):
'Available (purchase price) up to and including 6100.00 -> VW Polo
'Available (purchase price) up to and including 7100.00 -> (Case Else) Not on offer
CLS
INPUT "Purchase Price: "; purchase_price
SELECT CASE purchase_price
CASE IS <= 6100.00
PRINT "VW Polo."
CASE 6100.01 TO 7100.00
PRINT "6100.01 TO 7100.00"
CASE ELSE
PRINT "Not an offer"
END SELECT
SLEEP
RUN ' Try another price.
Shoot first and shoot people who ask questions, later.
Posts: 2,697
Threads: 327
Joined: Apr 2022
Reputation:
217
Is this basically what you're looking for?
Code: (Select All) 'Beispiel fuer Select Case und EveryCase - 7. Nov. 2022
Option _Explicit
Dim As Double kaufpreis
Print "Gebrauchtwagenkauf"
Print
Input "Wieviel moechten Sie ausgeben? ", kaufpreis
Print "Select Case:"
Select Case kaufpreis
Case 4000 To 5000
Print "Trabant, blau, frisiert - 31 KW."
Case 5000 To 6000
Print "Wartburg, dunkelgruen, 74.00 KM, 40 KW."
Case 5500 To 7000
Print "VW Polo, beige, 110.000 KM, 44 KW"
Case Else
Print "Haben wir leider nicht im Angebot!"
End Select
Print
Print "Select EveryCase:"
Select EveryCase kaufpreis
Case 4000 To 5000
Print "Trabant, blau, frisiert - 31 KW."
Case 5000 To 6000
Print "Wartburg, dunkelgruen, 74.00 KM, 40 KW."
Case 5500 To 7000
Print "VW Polo, beige, 110.000 KM, 44 KW"
Case Else
Print "Haben wir leider nicht im Angebot!"
End Select
End
Posts: 2,177
Threads: 222
Joined: Apr 2022
Reputation:
104
11-08-2022, 04:17 PM
(This post was last modified: 11-08-2022, 04:17 PM by Pete.)
I wish Musk would hurry up and invent the Universal translator. Honestly, the Kernel must struggle with the language here a lot, and I can't imagine how the guys from Australia can even keep up.
Pete
Posts: 1,002
Threads: 50
Joined: May 2022
Reputation:
27
Quote:Is this basically what you're looking for?
Yes! With Select EveryCase, a buyer would see all the offers that are within their price range. With Select Case, only what comes first.
Posts: 2,177
Threads: 222
Joined: Apr 2022
Reputation:
104
Nice. For further reference, we had discussion about SELECT EVERYCASE in this thread as well: https://qb64phoenix.com/forum/showthread...04#pid9304
Pete
Posts: 1,002
Threads: 50
Joined: May 2022
Reputation:
27
11-08-2022, 04:28 PM
(This post was last modified: 11-08-2022, 04:30 PM by Kernelpanic.)
@Pete - The example works like this, but in practice you only have one choice.
PS: I know the thread, it was the suggestion for my example.
|