Rust variables, mutable variables – tutorials # 2

Rust variables, mutable variables – tutorials # 2

How to create variable in RUST?

To create a integer variable, you can simply write

let x = 42

To create a string variable, you can simply write

let x = "string variable"

What is mutable variable?

Those variable which you want to use again and again.

Those variable which you can use more once.

You can assign values multiple times.

Once you assign value. You can change it later.

To create a mutable variable, you can simply write

let mut x = 420

and then you reassign value to it like this.

x = 422

What is immutable variables?

if you can’t reassign value to variable , they are immutable.

If you can’t change value of varible. They are immutable.

 

 

Source Code

 

Tony BB
 

TonyBB is a Coach , marketer, hypnotist and a founder of RSKVF Production who specializes in providing simple, affordable, and easy to use solutions for Life.

Click Here to Leave a Comment Below 0 comments

Leave a Reply: