Unexpected result while debugging project

Vending Machine.xaml (22.5 KB)

Hello people, I have a question, please. When I run my .xaml everything goes well until I need to press on “Request my change”.

Instead of ending the process and getting “Thank you. May you be well.” in a message box, I am getting prompted to the “Choose an option and insert money” option that comes in the first message box.

The message box containing the thank you message only pops up if I run out of money. But I want my change back.

I am confused.

@Yoichi Hello friend, could I ask for your help again? :pray:

@Yoichi @Athira

I found the solution:

This was the mistake^ I was leaving the first Else unpopulated, while leaving the second Else populated.

I switched it to this:

This solved the issue. Thank you very much.

1 Like

Hi @Federico_L Question is a bit unclear, but as per my understanding, instead of checking NextAction.equals(“Request my change”) you are doing NextAction.equals(“Get change”)

1 Like

Vending Machine.xaml (23.1 KB)
@yoichi @athira

Hello! I have another problem, could I ask of your help please?

I fixed the “Get change” part but now everytime I click on “Buy a new drink.”

I get this, instead of being prompted to buy another drink:

hello @Athira I tried this but didn’t work.

The problem is that when I debug the project and choose the “Buy a new drink” option, instead of offering me the options to buy a new drink, the process finishes and gives me the change back.

@Federico_L I didn’t quiet understand the solution you have given because the condition is checking for “Get change” whereas the options are entirely different. I might have missed something. But the code i am uploading is working for me, though i am not seeing all the exception scenarios handled, but i believe you are doing this for learning purpose so it should be fine. Only thing i have done is changing that condition.
Vending Machine.xaml (23.1 KB)

1 Like

thank you, this works!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.