Update example.zd

This commit is contained in:
2026-05-06 20:49:12 -04:00
parent b470109fea
commit 979d9323cd

View File

@@ -1,90 +1,92 @@
using Math;
using System as Sys;
namespace Demo;
struct Vector2
{
int x;
int y;
}
class Player
{
string name;
int health = 100;
bool alive = true;
int Add(int a, int b)
{
return a + b;
}
void PrintStatus()
{
if (health <= 0)
{
alive = false;
}
else if (health < 25)
{
health = health + 1;
}
else
{
health = health;
}
}
void Update()
{
int i = 0;
while (i < 3)
{
health = health - 10;
i = i + 1;
}
for (i = 0; i < 5; i = i + 1)
{
if (i == 3)
{
break;
}
}
repeat (2)
{
health = health + 5;
}
return;
}
}
class Game
{
Player player;
void Main()
{
player = new Player
{
name = "Hero";
health = 75;
};
int score = 0;
bool running = true;
if (running && player.health > 0)
{
score = player.Add(10, 20);
}
player.Update();
return;
}
using Math;
using System as Sys;
// this is a comment
namespace Demo;
struct Vector2
{
int x;
int y;
}
class Player
{
string name;
int health = 100;
bool alive = true;
int Add(int a, int b)
{
return a + b;
}
void PrintStatus()
{
if (health <= 0)
{
alive = false;
}
else if (health < 25)
{
health = health + 1;
}
else
{
health = health;
}
}
void Update()
{
int i = 0;
while (i < 3)
{
health = health - 10;
i = i + 1;
}
for (i = 0; i < 5; i = i + 1)
{
if (i == 3)
{
break;
}
}
repeat (2)
{
health = health + 5;
}
return;
}
}
class Game
{
Player player;
void Main()
{
player = new Player
{
name = "Hero";
health = 75;
};
int score = 0;
bool running = true;
if (running && player.health > 0)
{
score = player.Add(10, 20);
}
player.Update();
return;
}
}