Skip to content

Add Calculator project files#460

Open
ShPet1304 wants to merge 1 commit intoTheCSharpAcademy:mainfrom
ShPet1304:main
Open

Add Calculator project files#460
ShPet1304 wants to merge 1 commit intoTheCSharpAcademy:mainfrom
ShPet1304:main

Conversation

@ShPet1304
Copy link

No description provided.

@kilozdazolik kilozdazolik self-assigned this Feb 2, 2026
Copy link
Collaborator

@kilozdazolik kilozdazolik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Great job on the project, the calculator works perfectly and handles errors nicely!
I just left a couple of suggestions to make the code a bit cleaner.
Keep up the good work! 😁

}
}

public void GetUsageCount()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are iterating through the list to count the elements.
Lists in C# have a built-in .Count property which is much cleaner and more efficient. 😊
You could simply replace the loop with count = history.Count;

public bool reusedResult = false;
public double reusedNumber = 0;

public void Function()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method is doing a lot of things at once (getting input, validation, logic, displaying results). It makes it a bit hard to follow. Consider breaking it down into smaller helper methods, for example: GetValidNumber() could handle the input parsing loop separately. 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants