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.
在 php 下划线(“_”)中,它是私有/受保护函数的声明,但我在 PAWN 中没有找到任何关于它的信息。它在PAWN中有什么意义吗?
这取决于。
在函数名中没有任何意义,所以_hello只是意味着函数被命名_hello。(然后,如果您愿意,您可以阅读所有以下划线开头的函数作为不能在公共代码中调用的函数。但 PAWN 不会强迫您)
_hello
如果您在调用函数时指的是参数中的下划线,那么它的意思是“使用默认值”,所以如果您有
stock hello(num = 5) { }
hello(_)然后您可以使用(默认值)hello调用并将调用。num5
hello(_)
hello
num
5