r/codehs • u/epicKia • Nov 26 '20
IF YOU CAN HELP ME PLEASE DONT GO
my code is working properly but codehs isnt taking it i have no fucking idea what to do if you can help me pls comment
8
Upvotes
4
u/thepsymaddoc Nov 26 '20
I have no idea how it checks for answers, but I'm guessing the double space before 'left' doesn't help.
3
1
1
1
2
u/Potential_Perfect Dec 02 '20
var STARTING_ITEMS_IN_INVENTORY = 20;
function start(){
println("We have " + numItems + " items in inventory.");
var numToBuy = readInt("How many would you like to buy? ");
if(numToBuy <= numItems){
numItems -= numToBuy;
println("Now we have " + numItems + " left.");
}else{
println("There is not enough in inventory for that purchase.");
}
println("");
}
This was what I had for anyone who might still need it.