❔ Hello guys, I'm just trying to create two functionalities which's borrow and return books.

Zzonedetec11/7/2022
Hello
FFaraj11/7/2022
Hello there
FFaraj11/7/2022
I hope you could help me out with this project 🤗
FFaraj11/7/2022
Are you available?
TTimtier11/7/2022
What are you having problems with?
FFaraj11/7/2022
Thanks a lot for showing up 🙂 I've been stuck with this project for a weeks.
FFaraj11/7/2022
Since I'm a beginner and trying to practice my code skills. I'm building this project where I could enable the user to borrow & return books.
FFaraj11/7/2022
The issue is every time I enter a book title it displays
Console.WriteLine("Please enter a valid book! "); 
FFaraj11/7/2022
My goal is that when the user types the title of the book it should borrow by removing the book from libraryBooks and adding it to the MyBooks list.
FFaraj11/7/2022
And the opposite when returning the book
FFaraj11/7/2022
I am bad at coding and I would love to learn how to code, but a project like this seems hard for me to code a lone by my self 🤷🏻‍♂️
Bblinkbat11/7/2022
start simpler. can you make a console app that does simple math calculations with two numbers and an operator?
Bblinkbat11/7/2022
if not, can you make one that takes the user's name input and puts it into a sentence?
FFaraj11/7/2022
Well! These stuff are very simple, I've been doing the a lot through tutorials.
FFaraj11/7/2022
But my project, I think is too advanced for me too.
TTimtier11/7/2022
You can always try to define what you're doing in smaller, more manageable or easier to understand steps 🙂
FFaraj11/7/2022
I've heard this not once but hundreds of times and this are what I'm trying to do.
TTimtier11/7/2022
But if you want we can have a look at the specific issue you're encountering
FFaraj11/7/2022
For example! If I would apply this to my example, how am I going to do this in small steps? Can you provide me with some hints?
FFaraj11/7/2022
Sounds great 😃
TTimtier11/7/2022
For small steps I would mean more the full program or chunks of it, but we can get back to that later 🙂
FFaraj11/7/2022
I would love to learn how to code and very excited, but when I get stuck, it just feels boring and not know what to do or what step should I take.
TTimtier11/7/2022
So my first hint would be here; find where you have the Please enter a valid book! in your code so you know at what piece of code you likely have to look.
TTimtier11/7/2022
Plus, does this only happen when borrowing a book, when you return it, or both?
FFaraj11/7/2022
You're right. My first issue is in this code
FFaraj11/7/2022
Image
FFaraj11/7/2022
Not really sure where the issue is, but this code gets printed when I type a book title
"Please enter a valid book! " 
TTimtier11/7/2022
Even when you enter the correct title?
FFaraj11/7/2022
Yep
EEro11/7/2022
Especially when they enter a correct title. The condition is wrong
EEro11/7/2022
It's saying the title is invalid when it does exist
FFaraj11/7/2022
Oh! Really. It was some guy who wrote this project for me, I'm not sure if got it right 🤔
TTimtier11/7/2022
Hope you didn't pay 😛
EEro11/7/2022
I mean why do we have to riddle this for you? Literally look at the code, it's self explanatory
EEro11/7/2022
while Exists is true, print Book Invalid
FFaraj11/7/2022
No, it's just a guy I met who studies computer science, who usually calls me and teaches me how to build projects and explains every line of code.
TTimtier11/7/2022
They've specifically said they're a beginner. But I'd agree to start a bit simpler to get more knowledge of the concepts that are used here
TTimtier11/7/2022
If you are getting used to it, or are trying to your own program, it's beneficial to write it in pseudocode like the example from Ero before you try to "make it work".
TTimtier11/7/2022
It's a bit easier to write down something along of the lines of
if I want to borrow a book and the library has it, I can borrow it. 

if I want to borrow a book and the library does not have it, I can't borrow it 
FFaraj11/7/2022
You're right. It looks exactly as you described. But I don't know what this line of code exactly means!
 (x => x.Title == title) 
TTimtier11/7/2022
That's a predicate, or shortly put;

Given item x from the collection of library books, it checks if the Title of Book x is the same as the title variable.
EEro11/7/2022
MyBooks is a collection. Exists "walks" that collection, and does a check for every element it finds. for every element it finds, it executes the function x => x.Title == title where x is the current element to check
EEro11/7/2022
using x in predicates is very bad practice that way too many people do
EEro11/7/2022
MyBooks.Exists(book => book.Title == title)
FFaraj11/7/2022
Ok! Wow, that's a whole amount of rewarding information and tips regarding my project. I learned a lot of things from you guys that I had no idea about it.
FFaraj11/7/2022
This is what confused most are these x stuff.
FFaraj11/7/2022
So is Exists used as a method in this case and not only a word?
TTimtier11/7/2022
Yep, it is a method that belongs to a List
FFaraj11/7/2022
Ok! Now, I understood almost the whole idea. Let me practice by modifying the code and see if I get it right.
TTimtier11/7/2022
Good luck!
FFaraj11/7/2022
Thank you so much 🤗
FFaraj11/7/2022
Can I show you my updated project so you can just review it later?
TTimtier11/7/2022
Sure, how strict do you want me to be? 😛
FFaraj11/7/2022
You decide 😁
FFaraj11/8/2022
Guys, yesterday, I found out that it was me who changed it from false to true, so it was my fault 😆
 while (MyBooks.Exists(book => book.Title == title) is false) 
https://paste.mod.gg/nhpayuykleaz/2
AAccord11/22/2022
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.