1
0
Fork 0
mirror of https://github.com/ratfactor/ziglings synced 2024-05-24 22:36:06 +02:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Chris Boesch 9d6f1e2f36
Merge pull request #346 from ratfactor/i339
changed struct name 'class' into 'role'
2023-08-02 23:39:59 +02:00
Chris Boesch 3fbabe40fb changed struct name 'class' into 'role' 2023-08-02 23:29:02 +02:00
3 changed files with 9 additions and 9 deletions

View File

@ -22,8 +22,8 @@
// //
const std = @import("std"); const std = @import("std");
// We'll use an enum to specify the character class. // We'll use an enum to specify the character role.
const Class = enum { const Role = enum {
wizard, wizard,
thief, thief,
bard, bard,
@ -33,7 +33,7 @@ const Class = enum {
// Please add a new property to this struct called "health" and make // Please add a new property to this struct called "health" and make
// it a u8 integer type. // it a u8 integer type.
const Character = struct { const Character = struct {
class: Class, role: Role,
gold: u32, gold: u32,
experience: u32, experience: u32,
}; };
@ -41,7 +41,7 @@ const Character = struct {
pub fn main() void { pub fn main() void {
// Please initialize Glorp with 100 health. // Please initialize Glorp with 100 health.
var glorp_the_wise = Character{ var glorp_the_wise = Character{
.class = Class.wizard, .role = Role.wizard,
.gold = 20, .gold = 20,
.experience = 10, .experience = 10,
}; };

View File

@ -8,7 +8,7 @@
// //
const std = @import("std"); const std = @import("std");
const Class = enum { const Role = enum {
wizard, wizard,
thief, thief,
bard, bard,
@ -16,7 +16,7 @@ const Class = enum {
}; };
const Character = struct { const Character = struct {
class: Class, role: Role,
gold: u32, gold: u32,
health: u8, health: u8,
experience: u32, experience: u32,
@ -27,7 +27,7 @@ pub fn main() void {
// Glorp the Wise // Glorp the Wise
chars[0] = Character{ chars[0] = Character{
.class = Class.wizard, .role = Role.wizard,
.gold = 20, .gold = 20,
.health = 100, .health = 100,
.experience = 10, .experience = 10,
@ -35,7 +35,7 @@ pub fn main() void {
// Please add "Zump the Loud" with the following properties: // Please add "Zump the Loud" with the following properties:
// //
// class bard // role bard
// gold 10 // gold 10
// health 100 // health 100
// experience 20 // experience 20

View File

@ -1,6 +1,6 @@
44a45,50 44a45,50
> chars[1] = Character{ > chars[1] = Character{
> .class = Class.bard, > .role = Role.bard,
> .gold = 10, > .gold = 10,
> .health = 100, > .health = 100,
> .experience = 20, > .experience = 20,