{"id":205800,"date":"2020-12-03T08:20:03","date_gmt":"2020-12-03T00:20:03","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=205800"},"modified":"2020-11-23T11:22:28","modified_gmt":"2020-11-23T03:22:28","slug":"how-rust-outputs","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/how-rust-outputs.html","title":{"rendered":"Rust \u5982\u4f55\u8f93\u51fa\u5230\u547d\u4ee4\u884c"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | Rust \u8bed\u8a00\u662f\u4e00\u79cd\u9ad8\u6548\u3001\u53ef\u9760\u7684\u901a\u7528\u9ad8\u7ea7\u8bed\u8a00\u3002\u5176\u9ad8\u6548\u4e0d\u4ec5\u9650\u4e8e\u5f00\u53d1\u6548\u7387\uff0c\u5b83\u7684\u6267\u884c\u6548\u7387\u4e5f\u662f\u4ee4\u4eba\u79f0\u8d5e\u7684\uff0c\u662f\u4e00\u79cd\u5c11\u6709\u7684\u517c\u987e\u5f00\u53d1\u6548\u7387\u548c\u6267\u884c\u6548\u7387\u7684\u8bed\u8a00\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u5728\u4e4b\u524d\u7684 Hello, World \u7a0b\u5e8f\u4e2d\u5927\u6982\u5df2\u7ecf\u544a\u8bc9\u4e86\u5927\u5bb6\u8f93\u51fa\u5b57\u7b26\u4e32\u7684\u65b9\u5f0f\uff0c\u4f46\u5e76\u4e0d\u5168\u9762\uff0c\u5927\u5bb6\u53ef\u80fd\u5f88\u7591\u60d1\u4e3a\u4ec0\u4e48 println!( \"Hello World\") \u4e2d\u7684 println \u540e\u9762\u8fd8\u6709\u4e00\u4e2a ! \u7b26\u53f7\uff0c\u96be\u9053 Rust \u51fd\u6570\u4e4b\u540e\u90fd\u8981\u52a0\u4e00\u4e2a\u611f\u53f9\u53f7\uff1f\u663e\u7136\u5e76\u4e0d\u662f\u8fd9\u6837\u3002println \u4e0d\u662f\u4e00\u4e2a\u51fd\u6570\uff0c\u800c\u662f\u4e00\u4e2a\u5b8f\u89c4\u5219\u3002\u8fd9\u91cc\u4e0d\u9700\u8981\u66f4\u6df1\u523b\u7684\u6316\u6398\u5b8f\u89c4\u5219\u662f\u4ec0\u4e48\uff0c\u540e\u9762\u7684\u7ae0\u8282\u4e2d\u4f1a\u4e13\u95e8\u4ecb\u7ecd\uff0c\u5e76\u4e0d\u5f71\u54cd\u63a5\u4e0b\u6765\u7684\u4e00\u6bb5\u5b66\u4e60\u3002<\/p>\n Rust \u8f93\u51fa\u6587\u5b57\u7684\u65b9\u5f0f\u4e3b\u8981\u6709\u4e24\u79cd\uff1aprintln!() \u548c print!()\u3002\u8fd9\u4e24\u4e2a\"\u51fd\u6570\"\u90fd\u662f\u5411\u547d\u4ee4\u884c\u8f93\u51fa\u5b57\u7b26\u4e32\u7684\u65b9\u6cd5\uff0c\u533a\u522b\u4ec5\u5728\u4e8e\u524d\u8005\u4f1a\u5728\u8f93\u51fa\u7684\u6700\u540e\u9644\u52a0\u8f93\u51fa\u4e00\u4e2a\u6362\u884c\u7b26\u3002\u5f53\u7528\u8fd9\u4e24\u4e2a\"\u51fd\u6570\"\u8f93\u51fa\u4fe1\u606f\u7684\u65f6\u5019\uff0c\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u683c\u5f0f\u5b57\u7b26\u4e32\uff0c\u540e\u9762\u662f\u4e00\u4e32\u53ef\u53d8\u53c2\u6570\uff0c\u5bf9\u5e94\u7740\u683c\u5f0f\u5b57\u7b26\u4e32\u4e2d\u7684\"\u5360\u4f4d\u7b26\"\uff0c\u8fd9\u4e00\u70b9\u4e0e C \u8bed\u8a00\u4e2d\u7684 printf \u51fd\u6570\u5f88\u76f8\u4f3c\u3002\u4f46\u662f\uff0cRust \u4e2d\u683c\u5f0f\u5b57\u7b26\u4e32\u4e2d\u7684\u5360\u4f4d\u7b26\u4e0d\u662f\"% + \u5b57\u6bcd\"\u7684\u5f62\u5f0f\uff0c\u800c\u662f\u4e00\u5bf9 {}\u3002<\/p>\n \u5b9e\u4f8b<\/strong><\/div>\n \r\nfn main() {\r\n let a = 12;\r\n println!(\"a is {}\", a);\r\n}<\/pre>\n |