Hello,
This is probably an easy one, but I’m not a very experienced programmer. I understand what the error “Not all code paths return a value” means, but I don’t know why I would get it in this case.
I’m creating an inventory system for an RPG from scratch, I have the following function to look for a null space in the inventory array, if it is null, put Item in it. The function will then return a string “Added Item” or “Inventory full.” What’s wrong here?
public string AddItem(Item addedItem){
for(int i = 0; i < baseInvSize; i++){
if(playerInventory *== null){*
_ playerInventory = addedItem;_
* return “added”;*
* }*
* else*
* return “Inventory Full”;*
* }*
}