Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
你可以说:
currentImage = (imageMax + currentImage - 1) % imageMax;
在执行取模运算符之前添加 imageMax 可以处理减去 1 后 imageMax 小于零的情况。