如何忽略 Nim 中程序的结果

How to ignore the result from a procedure in Nim

根据标题,假设我有以下内容:

proc squared(n: int64): int64 = n * n

现在假设我想调用过程 squared 但我对结果不感兴趣。

如果我只写:

squared(15)

我收到一个错误:

Error: expression 'squared(15)' is of type 'int64' and has to be discarded

我知道这种类型的代码是一种不好的做法,我应该明确忽略结果。 因此,如何明确忽略结果?

随便写

discard squared(15)