gpt4 book ai didi

livescript - 如何忽略返回结果

转载 作者:行者123 更新时间:2023-12-04 02:56:49 28 4
gpt4 key购买 nike

例如

child.stdout.on \data (buffer) -> 
result.stdout += buffer

-->

child.stdout.on('data', function(buffer){
return result.stdout += buffer;
});

我需要它,不返回。在 F# 中,我可以添加 |> ignore 我如何在 livescript 中处理它?<​​/p>

最佳答案

您可以在函数定义前添加一个!:

!(buffer) -> result.stdout += buffer

或者,返回 void

child.stdout.on \data (buffer) -> 
result.stdout += buffer
void

在 JavaScript 中,当你返回 undefined (void) 时,它等同于没有返回任何东西。

关于livescript - 如何忽略返回结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16517108/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com