In Ruby, I have code similar to the following
foo { |x, y| puts y }
Since the compiler / interpreter warns me about unused var X, I replaced x with "*" and the compiler stopped complaining. (I don’t know why I decided it was the best choice ... It just happened ...)
foo { |*, y| puts y }
What does it do? Are there any side effects?
An asterisk in this context is called the "splat" operator. This means that you can pass several parameters in their place, and the block will see them as an array.
, (, foo { |*x, y| puts y }). , , , , .
foo { |*x, y| puts y }
Source: https://habr.com/ru/post/1764899/More articles:Can XmlSerializer.Deserialize return null? - c #FileNotFoundException + Write file to SD card - androidhow to read spring beans definitions - javaChanging the summary variables returned with Hmisc summary () - rHow to allocate more memory for your program (GCC) - cHow to execute code in a GUI thread? - multithreadingcmake - How to set different variables for Intel compiler - compiler-constructionPython устанавливает уровень отчетности об ошибках, как в PHP - pythonG ++ Version Compatibility - c ++Параметры .NET и MySql, переменные NULL AddWithValue, как избежать проверки нулей - nullAll Articles