Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed struct name 'class' into 'role' #346

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions exercises/037_structs.zig
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
//
const std = @import("std");

// We'll use an enum to specify the character class.
const Class = enum {
// We'll use an enum to specify the character role.
const Role = enum {
wizard,
thief,
bard,
Expand All @@ -33,15 +33,15 @@ const Class = enum {
// Please add a new property to this struct called "health" and make
// it a u8 integer type.
const Character = struct {
class: Class,
role: Role,
gold: u32,
experience: u32,
};

pub fn main() void {
// Please initialize Glorp with 100 health.
var glorp_the_wise = Character{
.class = Class.wizard,
.role = Role.wizard,
.gold = 20,
.experience = 10,
};
Expand Down
8 changes: 4 additions & 4 deletions exercises/038_structs2.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
//
const std = @import("std");

const Class = enum {
const Role = enum {
wizard,
thief,
bard,
warrior,
};

const Character = struct {
class: Class,
role: Role,
gold: u32,
health: u8,
experience: u32,
Expand All @@ -27,15 +27,15 @@ pub fn main() void {

// Glorp the Wise
chars[0] = Character{
.class = Class.wizard,
.role = Role.wizard,
.gold = 20,
.health = 100,
.experience = 10,
};

// Please add "Zump the Loud" with the following properties:
//
// class bard
// role bard
// gold 10
// health 100
// experience 20
Expand Down
2 changes: 1 addition & 1 deletion patches/patches/038_structs2.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
44a45,50
> chars[1] = Character{
> .class = Class.bard,
> .role = Role.bard,
> .gold = 10,
> .health = 100,
> .experience = 20,
Expand Down