当前位置: 首页 > news >正文

做网站价格多少钱音乐网站前端模板

做网站价格多少钱,音乐网站前端模板,网页制作教程app,网站建设具体流程1.做题须知 这一题告诉我们可以尝试修改下面的输出,在觉得OK之后删除// I AM NOT DONE注释即可进入下一题 // intro1.rs // About this I AM NOT DONE thing: // We sometimes encourage you to keep trying things on a given exercise, even // after you already figured …

1.做题须知

这一题告诉我们可以尝试修改下面的输出,在觉得OK之后删除// I AM NOT DONE注释即可进入下一题

// intro1.rs
// About this `I AM NOT DONE` thing:
// We sometimes encourage you to keep trying things on a given exercise, even
// after you already figured it out. If you got everything working and feel
// ready for the next exercise, remove the `I AM NOT DONE` comment below.
// Execute `rustlings hint intro1` or use the `hint` watch subcommand for a hint.
//
// If you're running this using `rustlings watch`: The exercise file will be reloaded
// when you change one of the lines below! Try adding a `println!` line, or try changing
// what it outputs in your terminal. Try removing a semicolon and see what happens!// I AM NOT DONEfn main() {println!("Hello and");println!(r#"       welcome to...                      "#);println!(r#"                 _   _ _                  "#);println!(r#"  _ __ _   _ ___| |_| (_)_ __   __ _ ___  "#);println!(r#" | '__| | | / __| __| | | '_ \ / _` / __| "#);println!(r#" | |  | |_| \__ \ |_| | | | | | (_| \__ \ "#);println!(r#" |_|   \__,_|___/\__|_|_|_| |_|\__, |___/ "#);println!(r#"                               |___/      "#);println!();println!("This exercise compiles successfully. The remaining exercises contain a compiler");println!("or logic error. The central concept behind Rustlings is to fix these errors and");println!("solve the exercises. Good luck!");println!();println!("The source for this exercise is in `exercises/intro/intro1.rs`. Have a look!");println!("Going forward, the source of the exercises will always be in the success/failure output.");
}

2.基本输出

我们使用{:?}通配输出一下就好了

// intro2.rs
// Make the code print a greeting to the world.
// Execute `rustlings hint intro2` or use the `hint` watch subcommand for a hint.fn main() {println!("Hello {:?}!","world");
}

3.变量绑定

由于Rust里面的变量完全属于主人,所以我们需要使用let语句来对变量进行绑定

// variables1.rs
// Make me compile!
// Execute `rustlings hint variables1` or use the `hint` watch subcommand for a hint.fn main() {let x = 5;println!("x has the value {}", x);
}

4.变量类型

这一题告诉我们变量需要类型,给类型只需要我们对其赋值即可,rust会自动分配他的类型

// variables2.rs
// Execute `rustlings hint variables2` or use the `hint` watch subcommand for a hint.fn main() {let x=3;if x == 10 {println!("x is ten!");} else {println!("x is not ten!");}
}

5.指定变量类型

我们需要对变量初始化赋值才能使用,而且可以使用:i32指定变量为32位整数

// variables3.rs
// Execute `rustlings hint variables3` or use the `hint` watch subcommand for a hint.fn main() {let x: i32=3;println!("Number {}", x);
}

6.创建可变类型变量

不设置变量为可变类型,就会在改变时报错

// variables4.rs
// Execute `rustlings hint variables4` or use the `hint` watch subcommand for a hint.fn main() {let mut x = 3;println!("Number {}", x);x = 5; // don't change this lineprintln!("Number {}", x);
}

7.重新绑定(变量遮蔽)

当需要用一个变量读取不同类型的数据的时候 可以使用let+数据类型重新创建一个

// variables5.rs
// Execute `rustlings hint variables5` or use the `hint` watch subcommand for a hint.fn main() {let mut number = "T-H-R-E-E"; // don't change this lineprintln!("Spell a Number : {}", number);let number:i32= 3; // don't rename this variableprintln!("Number plus two is : {:?}", number );
}

8.常量申明

常量不仅仅默认不可变,而且自始至终不可变,因为常量在编译完成后,已经确定它的值。

常量使用 const 关键字而不是 let 关键字来声明,并且值的类型必须标注

// variables6.rs
// Execute `rustlings hint variables6` or use the `hint` watch subcommand for a hint.const NUMBER:i32 = 3;
fn main() {println!("Number {}", NUMBER);
}

9.书写函数

使用fn funName(){}来创建一个函数申明,然后在main函数里面调用

// functions1.rs
// Execute `rustlings hint functions1` or use the `hint` watch subcommand for a hint.fn call_me(){println!("Hello Rust");
}
fn main() {call_me();
}

10.函数传入形参需要指定类型

形参需要申明传入的变量的类型

// functions2.rs
// Execute `rustlings hint functions2` or use the `hint` watch subcommand for a hint.fn main() {call_me(3);
}fn call_me(num:i32) {for i in 0..num {println!("Ring! Call number {}", i + 1);}
}

http://www.yayakq.cn/news/338772/

相关文章:

  • wordpress 如何使用模板Wordpress打开速度优化插件
  • 网站更换域名seo抖音关键词推广
  • 免费网站注册软件定制软件开发公司
  • 成都建设网官方网站wordpress文章版权投诉
  • 昌乐营销型网站建设个人承接网站开发项目
  • 上传网站空间网站建设需要的功能
  • 可以进行网站外链建设的有企业网站推广最有效的方法
  • 旅游景点网站策划书软文范例
  • 网站建设费用会计入什么费用做电影网站如何买版权
  • 树莓派wordpress建站wordpress邮箱链接无效
  • 晋江企业网站开发免费虚拟主机免费空间
  • 建设大淘客网站0453牡丹江免费信息网手机版
  • 西安网站设计锦wordpress模版位置
  • 义乌外贸公司网站小伟破解WordPress主题
  • 关于图书网站建设的书籍最近军事新闻
  • 中国建设银行网站用户名制作外贸网站公司
  • 雄安建设集团有限公司网站全国安装平台有哪些
  • 深圳租赁住房和建设局网站php做的网站首页是什么文件
  • 个人网站建设报告视频一页网站怎么做
  • 德州商城网站建设徐州网站建设xzqjw
  • 百度收录好的网站排名中国万网官方网站
  • 网站设计开发网站建设实训课
  • 国际最好的摄影作品网站拓者设计吧室内效果图轻奢
  • 线上网站开发相关书籍在手机里面开网店怎么开
  • c在线编程网站怎么做一个公司的网站
  • 电子商务网站建设参考书网站建设分金手指专业二九
  • 网站备案个人备案公司网站酷家乐软件培训班
  • 大连网站建设特色崇文网站建设
  • 百度为什么会k网站伊春网络运营推广
  • 电子商务网站建设试卷.docwordpress koncept 下载