Basic (com números e estruturado) , dBase III Plus , Clipper , Pascal , Cobol , Delphi (ObjectPascal) , C , C++ , ActionScript (Flash) , PHP , JavaScript , Python , Objective-C , Clojure , Java , Scala , Rust.
fn main() {
println!("Hello, world!");
}
Tempo para gerar esse código:
cargo init
"Cargo is the Rust package manager"
"Cargo downloads your Rust package’s dependencies, compiles your packages, makes distributable packages, and uploads them to crates.io, the Rust community’s package registry."
fn main() {
let a:u8 = 2;
println!("{}", a);
}
fn main() {
let a = 2u8;
println!("{}", a);
}
fn main() {
let a = 2;
println!("{}", a);
}
fn factorial(i: u64) -> u64 {
match i {
0 => 1,
n => n * factorial(n-1)
}
}
fn is_pred(i: u64) -> Bool {
if i % 2 == 0 {
True
} else {
False
}
}
fn is_pred(i: u64) -> Bool {
i % 2 == 0
}
enum IPAddr {
IPV4,
IPV6
}
enum IPAddr {
IPV4(String),
IPV6(String)
}
let home = IpAddr::V4(String::from("127.0.0.1");
match home {
V4(ipv4_address) => println!("IPv4 addr: {}", ipv4_address),
V6(ipv6_address) => println!("Ipv6 addr: {}", ipv6_address),
}
match may_not_exist(value: Option<String>) {
match value {
Some(the_string) => println!("I got a string! {}", the_string),
None => println!("I got nothing")
}
}
fn main() {
let a = String::from("A reference to a string in the code section copied to the stack");
let b = a;
println!("The string is: {}", a);
}
fn main() {
let a = String::from("A reference to a string in the code section copied to the stack");
let b = &a;
println!("The string is: {}", a);
}
presente := Presente { ... }
canal <- presente
presente := Presente { ... }
canal <- presente
presente.abrir()
fn main() {
let a = 3;
a = 5;
}
enum Result<T, E> {
Ok(T),
Err(E),
}
match File::create("something.txt") {
Ok(fp) => fp.write_all(b"Hello world"),
Err(err) => println!("Failure! {}", err),
}
fn main() {
let a = 2;
a = 3;
println!("{}", a);
}
3 | let a = 2;
| -
| |
| first assignment to `a`
| help: make this binding mutable: `mut a`
4 | a = 3;
| ^^^^^ cannot assign twice to immutable variable
3 | let a = 2;
| -
| |
| first assignment to `a`
| help: make this binding mutable: `mut a`
4 | a = 3;
| ^^^^^ cannot assign twice to immutable variable
3 | let a = 2;
| -
| |
| first assignment to `a`
| help: make this binding mutable: `mut a`
4 | a = 3;
| ^^^^^ cannot assign twice to immutable variable
A linguagem mais amada segundo o StackOverflow Survey 2019
... pelo 4⁰ ano seguido.