Added Ex. 2, polished script, added LICENSE
parent
3b5678815f
commit
d618414c9c
@ -0,0 +1,21 @@
|
||||
//
|
||||
// Oops! This program is supposed to print a line like our Hello World
|
||||
// example. But we forgot how to import the Zig Standard Library.
|
||||
//
|
||||
// Hint 1: The @import() built-in function returns a value representing
|
||||
// imported code. We need to give that value a name to use it.
|
||||
// Hint 2: We use the name "std" in the main function (see below).
|
||||
// Hint 3: Imports need to be named by declaring them as "const" values.
|
||||
// Hint 4: Take a look at how the previous exercise did this!
|
||||
//
|
||||
@import("std");
|
||||
|
||||
pub fn main() void {
|
||||
std.debug.print("Standard Library.\n", .{});
|
||||
}
|
||||
|
||||
// Going deeper: imports must be declared as "constants" (with the 'const'
|
||||
// keyword rather than "variables" (with the 'var' keyword) is that they
|
||||
// can only be used at "compile time" rather than "run time". Zig evaluates
|
||||
// const values at compile time. Don't worry if none of this makes sense
|
||||
// yet! See also this answer: https://stackoverflow.com/a/62567550/695615
|
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Dave Gauer
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
Loading…
Reference in New Issue