87 lines
1.4 KiB
Plaintext
87 lines
1.4 KiB
Plaintext
|
|
||
|
enum Wah {
|
||
|
A,
|
||
|
B,
|
||
|
C,
|
||
|
D
|
||
|
}
|
||
|
|
||
|
struct Baz {
|
||
|
owo: i32,
|
||
|
uwu: usize
|
||
|
}
|
||
|
|
||
|
/// Type definitions
|
||
|
// type Rah = &Baz;
|
||
|
|
||
|
/// Different kinds of functions
|
||
|
// Normal function
|
||
|
// fn main(a: &Foo, b: Rah) -> Nya {
|
||
|
/// General expressions (math)
|
||
|
// Works
|
||
|
// let a = 1 * 3 == 4;
|
||
|
// let b = 3/4 == *a;
|
||
|
// let c = (a->b.c->d) / 2;
|
||
|
// let d = 2 / a->b.c->d;
|
||
|
// let e = a->b.c->d / 2;
|
||
|
// let f = a.b.c.d / 2;
|
||
|
// let g = a.b[a.c] * 5;
|
||
|
|
||
|
// No worky
|
||
|
// nothing! yay!
|
||
|
|
||
|
/// Struct literals
|
||
|
// let a = Baz {
|
||
|
// owo: a,
|
||
|
// uwu: b + c / d
|
||
|
// };
|
||
|
|
||
|
/// If statement
|
||
|
// if 1 > 3 {
|
||
|
// ";3"
|
||
|
// } else
|
||
|
// if *a == 3 {
|
||
|
// ":0"
|
||
|
// } else {
|
||
|
// ">:("
|
||
|
// }
|
||
|
|
||
|
|
||
|
/// 3 kinds of loops all doing the same thing
|
||
|
/// While loops
|
||
|
// let iw = 0;
|
||
|
// while iw < 10 {
|
||
|
// println("Owo");
|
||
|
// }
|
||
|
|
||
|
/// For loops
|
||
|
// for let ifr = 0 ; ifr < 20 ; ifr += 1 {
|
||
|
// println("nya");
|
||
|
// }
|
||
|
|
||
|
/// Infinite loops
|
||
|
// let il = 0;
|
||
|
// loop {
|
||
|
// if il > 10 {
|
||
|
// break;
|
||
|
// }
|
||
|
// println("Rah");
|
||
|
// }
|
||
|
|
||
|
/// Function Calls
|
||
|
// println(":3");
|
||
|
//}
|
||
|
|
||
|
// Struct member function with inner data
|
||
|
//fn Baz.main(self: &mut Baz, a: &Foo, b: &mut Bar) -> &Nya;
|
||
|
|
||
|
// Struct member function without any data a.k.a a static member func
|
||
|
//fn Baz.main(a: &Foo, b: &mut Bar) -> &Nya;
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|