2 ms·
It's remarkable how similar Swift and Rust are w.r.t syntax. Rust, Swift let x = 42; let x = 42 let x: i32 = 42; let x: Int = 42 let _ = 42; let _ = 42 let
by deepGem 6y ago
It's remarkable how similar Swift and Rust are w.r.t syntax.
Rust, Swift
let x = 42;
let x = 42
let x: i32 = 42;
let x: Int = 42
let _ = 42;
let _ = 42
let pair: (char, i32) = ('a', 17);
let pair: (String, Int) = ("a", 17)
let (some_char, some_int) = ('a', 17);
let (some_char, some_int) = ("a", 17)
fn greet() {
println!("Hi there!");
}
func greet() {
print("Hi there!")
}
But, the languages are so different, for instance in Swift
let x
x = 42
let y = 13
let y = y + 3
Wont fly for instance. I am trying to come up with the simplest explanation possible for this but I can't - goes to show how much I understand either of the languages.
- Razengan 6y agoSwift tends to be a lot more readable with fewer ambiguities. Call me superficial but all the underscores and semicolons alone just feel like an eldritch summoning ritual in 2021.