dummy: fn main syntax! yay
This commit is contained in:
parent
8640ec4261
commit
46b17a7eb6
9
dummy.do
9
dummy.do
@ -3,9 +3,8 @@
|
|||||||
|
|
||||||
// This is a function. It can be called with the call operator.
|
// This is a function. It can be called with the call operator.
|
||||||
// The function called `main` is the program's entrypoint
|
// The function called `main` is the program's entrypoint
|
||||||
// fn main() -> (&str, bool, i128)
|
|
||||||
|
|
||||||
const main = fn () {
|
fn main() /*-> (&str, bool, i128)*/ {
|
||||||
// An if expression is like the ternary conditional operator in C
|
// An if expression is like the ternary conditional operator in C
|
||||||
let y = if 10 < 50 {
|
let y = if 10 < 50 {
|
||||||
"\u{1f988}"
|
"\u{1f988}"
|
||||||
@ -34,10 +33,10 @@ const main = fn () {
|
|||||||
|
|
||||||
// desugars to
|
// desugars to
|
||||||
{
|
{
|
||||||
let _pass = || if idx > 2 * 2 { break idx };
|
|
||||||
let _body = || { 12345 };
|
|
||||||
let _it = 0..100;
|
let _it = 0..100;
|
||||||
loop if let idx = _it.next() _pass() else _fail()
|
loop if let idx = _it.next() {
|
||||||
|
if idx > 2 * 2 { break idx }
|
||||||
|
} else break { 12345 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user