Join Abhiram Ravikumar for an in-depth discussion in this video Scalar data types: Floats, part of First Look: Rust.
- Rust also has two primitive types…for floating point numbers,…which are numbers with decimal points.…Rust floating point types are f32 and f64…which are 32 bits and 64 bits in size, respectively.…If you see the variable here, x has the value 2.0,…which by default, the Rust allocates 64 bits of space…and it's a floating point.…If you need to explicitly annotate the type to be 32 bits,…we can do as in the variable y.…
Add a colon, followed by f32,…and then assign it to whatever value you need.…As in most other programming languages,…a boolean type in Rust…has two possible values: true and false.…The boolean type in Rust…is specified using the keyword bool.…Typically, these types are used…whenever flags need to be set,…and based on the value of the flag,…allow the program to perform a certain operation.…So, if we want to set the value of t to be true,…we just write true, which is a keyword here.…
And true in other programming languages…you would know this as one.…And if we want to explicitly annotate,…we can do that by using the bool keyword, followed by false.…
- Installing Rust
- Data types
- Adjusting memory allocation
- Setting up race conditions
- Working with functions
- Exploring references and borrowing
- Using structs
- Method syntax
- Demonstrating recoverable errors with Result
- Working with enums
- Getting user input
Skill Level Beginner
Programming Foundations: Data Structures (2014)with Simon Allardice2h 29m Intermediate
1. Hello, Rust!
2. Basic Programming Concepts
3. Ownership in Rust
4. Data Handling and Pattern Matching in Rust
5. Error Handling
6. Sample Rust Project: The Guessing Game
Next steps1m 14s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.