官术网_书友最值得收藏!

The difference between println! and println

Up to this point, we've used println! for outputting text. This is fine, but consider what println! does. Whenever you see a ! mark, it symbolizes a macro. Macros are used when some part of the function needs to be executed at compile time, rather than at runtime.

Consider the following:

println!("{}", a); 
Console.WriteLine("{0}", a); 

In C#, the preceding snippet will output a line with the value of a on the line. In this case, a can be of any type that supports conversion to a formatted output. The same applies to Rust. A line is output with the value of a.

The println! macro is actually implemented in the Rust standard library.

主站蜘蛛池模板: 招远市| 大丰市| 米脂县| 浦北县| 诸城市| 清远市| 浦东新区| 苏州市| 兴山县| 宁夏| 清水县| 梁平县| 时尚| 黄平县| 竹北市| 崇信县| 万年县| 临漳县| 左贡县| 阿合奇县| 潼南县| 循化| 湟中县| 太康县| 错那县| 黄骅市| 新干县| 财经| 富源县| 怀宁县| 浮山县| 琼海市| 岳普湖县| 永吉县| 吉木乃县| 德江县| 祁连县| 绥江县| 奎屯市| 巴塘县| 桦南县|