jr priprava 5

This commit is contained in:
Priec
2026-02-14 15:10:11 +01:00
parent bd3036c63c
commit 1055a7fbf0
11 changed files with 1118 additions and 17 deletions

View File

@@ -1,19 +1,10 @@
use chrono::prelude::*;
fn main() {
// 1. How to create it
let letter: char = 'a'; // Use SINGLE quotes for char
let emoji: char = '🦀'; // Even emojis are exactly ONE char
// 2. Why it's useful
// You can ask it questions:
println!("{}", letter.is_alphabetic()); // Prints: true
println!("{}", letter.is_numeric()); // Prints: false
// 3. Converting to a number (The "Address" of the letter)
// Every letter has a unique number in the world (Unicode).
let number = 'a' as u32;
println!("{}", number); // Prints: 65
// 4. Converting a number back to a letter
let back_to_char = std::char::from_u32(97);
println!("{:?}", back_to_char); // Prints: Some('A')
let utc: DateTime<Utc> = Utc::now();
let local: DateTime<Local> = Local::now();
println!("{utc}");
println!("{local}");
}