Created
October 26, 2019 10:59
-
-
Save zesterer/0f67c86784abf154190b9654b00a86ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const std = struct { | |
io: struct { | |
print: |msg| { | |
__print(msg); | |
}, | |
println: |msg| { | |
self.print(msg + "\n"); | |
}, | |
input: || { | |
__input() | |
}, | |
ask: |msg| { | |
self.print(msg); | |
self.input() | |
}, | |
}, | |
iter: struct { | |
new: |next| { | |
struct { | |
next, | |
} | |
}, | |
range: |start, end| self.new(|| if start == end { | |
null | |
} else { | |
let next = start; | |
start += 1; | |
next | |
}), | |
}, | |
}; | |
// Prelude | |
const input = std.io.input; | |
const ask = std.io.ask; | |
const print = std.io.print; | |
const println = std.io.println; | |
var name = ask("What is your name?"); | |
println("Hello, " + name + "!"); | |
for x in range(0, 10) { | |
println("{x}"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment