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

  • 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.

主站蜘蛛池模板: 逊克县| 神池县| 肃宁县| 筠连县| 霍林郭勒市| 离岛区| 黑河市| 南京市| 武宣县| 棋牌| 左云县| 定南县| 虞城县| 鄂州市| 礼泉县| 台湾省| 银川市| 馆陶县| 达拉特旗| 利川市| 治县。| 郎溪县| 浦江县| 枞阳县| 普陀区| 博湖县| 鄯善县| 惠水县| 宝兴县| 青岛市| 高阳县| 宣武区| 潍坊市| 长治市| 胶州市| 宁河县| 株洲市| 武功县| 疏附县| 凤台县| 钟山县|