= and == 注意,在if語句中,必須使用==,因為=用于為變量賦值。 此外,您正在處理布爾運算,因此可以執行以下操作: if (checkBedDraw) { typePrint("You have already checked the drawers, and aqcuired a picklock.", 50);} else { clear(); typePrint("You found a \u001b[34mpicklock\u001b[0m! you can only use this on a specific lock, because of its shape. This item has been added to your \u001b[31minventory\u001b[0m.", 50); invArray[0] = "picklock"; checkBedDraw = true;}