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

  • Rust Programming By Example
  • Guillaume Gomez Antoni Boucher
  • 109字
  • 2021-07-02 19:12:55

Main function

Let's look again at our first project source code:

fn main() {
    println!("Hello, world!");
}

It only contains a main function—this is where the execution of the program begins. It is a function that takes no arguments (hence the empty parentheses) and returns a unit, also written (). The body of the function, between curly brackets, contains a call to the println!() macrowe can see this is a macro because it ends with !, as opposed to a function. This macro prints the text between parentheses, followed by a new line. We'll see what is a macro in the Macros section.

主站蜘蛛池模板: 堆龙德庆县| 宣威市| 紫阳县| 岚皋县| 安国市| 盘锦市| 崇礼县| 平原县| 志丹县| 呈贡县| 福建省| 邛崃市| 淳化县| 屯门区| 巴中市| 蒙城县| 石柱| 台中县| 施甸县| 宁远县| 通河县| 湄潭县| 长岭县| 阆中市| 锡林浩特市| 化德县| 洞头县| 九寨沟县| 安顺市| 阳朔县| 辽阳市| 泽库县| 安西县| 高陵县| 周宁县| 永寿县| 定结县| 大关县| 新余市| 穆棱市| 河西区|