You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Red 0.6.4(Windows命令行)中实现程序暂停?

How to Add a 1-Second Delay in Red 0.6.4 on Windows

Hey there! I see you're working with Red 0.6.4 on Windows and trying to keep your message visible for 1 second before the command prompt window closes—let me walk you through the fix.

The problem with your current code is that Red doesn't have built-in pause or sleep functions like some other languages. Instead, the correct way to add a delay in Red is using the wait function, which is part of the core language.

Here's your updated, working code:

Red []
; do something
print "Something, something..."
wait 1  ; Pauses execution for 1 second
quit

A few quick notes to clarify:

  • wait 1 tells the program to halt for exactly 1 second. You can also use decimal values (like wait 0.5) if you need shorter delays.
  • Since wait is a core Red function, it won't throw the "has no value" error you got with sleep or pause.

Just swap out your commented-out lines with wait 1, and your message will stay on screen for the desired time before the app exits.

内容的提问来源于stack exchange,提问作者Alex Baban

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.13 07:59:09