mirror of
https://codeberg.org/andyscott/ziglings.git
synced 2024-12-21 21:53:11 -05:00
059-061 completed
This commit is contained in:
parent
7108f89eb3
commit
d4ed21490e
3 changed files with 5 additions and 5 deletions
|
@ -20,9 +20,9 @@ const print = @import("std").debug.print;
|
||||||
|
|
||||||
pub fn main() void {
|
pub fn main() void {
|
||||||
const zig = [_]u8{
|
const zig = [_]u8{
|
||||||
0o131, // octal
|
0o132, // octal
|
||||||
0b1101000, // binary
|
0b1101001, // binary
|
||||||
0x66, // hex
|
0x67, // hex
|
||||||
};
|
};
|
||||||
|
|
||||||
print("{s} is cool.\n", .{zig});
|
print("{s} is cool.\n", .{zig});
|
||||||
|
|
|
@ -43,7 +43,7 @@ pub fn main() void {
|
||||||
//
|
//
|
||||||
// We'll convert this weight from pound to kilograms at a
|
// We'll convert this weight from pound to kilograms at a
|
||||||
// conversion of 0.453592kg to the pound.
|
// conversion of 0.453592kg to the pound.
|
||||||
const shuttle_weight: f16 = 0.453592 * 4480e6;
|
const shuttle_weight: f32 = 0.453592 * 4480e+3;
|
||||||
|
|
||||||
// By default, float values are formatted in scientific
|
// By default, float values are formatted in scientific
|
||||||
// notation. Try experimenting with '{d}' and '{d:.3}' to see
|
// notation. Try experimenting with '{d}' and '{d:.3}' to see
|
||||||
|
|
|
@ -67,7 +67,7 @@ const print = @import("std").debug.print;
|
||||||
pub fn main() void {
|
pub fn main() void {
|
||||||
var letter: u8 = 'A';
|
var letter: u8 = 'A';
|
||||||
|
|
||||||
const my_letter: ??? = &letter;
|
const my_letter: ?*[1]u8 = &letter;
|
||||||
// ^^^^^^^
|
// ^^^^^^^
|
||||||
// Your type here.
|
// Your type here.
|
||||||
// Must coerce from &letter (which is a *u8).
|
// Must coerce from &letter (which is a *u8).
|
||||||
|
|
Loading…
Reference in a new issue