Skip to content

Commit 9d6f1e2

Browse files
authored
Merge pull request #346 from ratfactor/i339
changed struct name 'class' into 'role'
2 parents d572302 + 3fbabe4 commit 9d6f1e2

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

exercises/037_structs.zig

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
//
2323
const std = @import("std");
2424

25-
// We'll use an enum to specify the character class.
26-
const Class = enum {
25+
// We'll use an enum to specify the character role.
26+
const Role = enum {
2727
wizard,
2828
thief,
2929
bard,
@@ -33,15 +33,15 @@ const Class = enum {
3333
// Please add a new property to this struct called "health" and make
3434
// it a u8 integer type.
3535
const Character = struct {
36-
class: Class,
36+
role: Role,
3737
gold: u32,
3838
experience: u32,
3939
};
4040

4141
pub fn main() void {
4242
// Please initialize Glorp with 100 health.
4343
var glorp_the_wise = Character{
44-
.class = Class.wizard,
44+
.role = Role.wizard,
4545
.gold = 20,
4646
.experience = 10,
4747
};

exercises/038_structs2.zig

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
//
99
const std = @import("std");
1010

11-
const Class = enum {
11+
const Role = enum {
1212
wizard,
1313
thief,
1414
bard,
1515
warrior,
1616
};
1717

1818
const Character = struct {
19-
class: Class,
19+
role: Role,
2020
gold: u32,
2121
health: u8,
2222
experience: u32,
@@ -27,15 +27,15 @@ pub fn main() void {
2727

2828
// Glorp the Wise
2929
chars[0] = Character{
30-
.class = Class.wizard,
30+
.role = Role.wizard,
3131
.gold = 20,
3232
.health = 100,
3333
.experience = 10,
3434
};
3535

3636
// Please add "Zump the Loud" with the following properties:
3737
//
38-
// class bard
38+
// role bard
3939
// gold 10
4040
// health 100
4141
// experience 20

patches/patches/038_structs2.patch

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
44a45,50
22
> chars[1] = Character{
3-
> .class = Class.bard,
3+
> .role = Role.bard,
44
> .gold = 10,
55
> .health = 100,
66
> .experience = 20,

0 commit comments

Comments
 (0)