wraith-lang/example.w

62 lines
974 B
OpenEdge ABL
Raw Normal View History

2021-04-28 23:01:48 +00:00
struct YourStruct
{
yourInt: int;
}
struct MyStruct
{
myInt: int;
myBool: bool;
yourStructReference: Reference<YourStruct>;
yourStruct: YourStruct;
Increment(): void
{
myInt = myInt + 1;
}
2021-04-29 19:42:51 +00:00
Decrement(): void
{
myInt = myInt - 1;
}
2021-04-28 23:01:48 +00:00
static MyFunction(input: int): int
{
return input * 2;
}
}
struct Program
{
static Main(): int
{
myStruct: MyStruct;
myReference: Reference<MyStruct>;
myInt: int;
myReference = alloc MyStruct;
myInt = MyStruct.MyFunction(2);
myStruct.myInt = myInt;
myStruct.Increment();
2021-04-29 04:25:25 +00:00
if (myStruct.myInt < 5)
{
myStruct.Increment();
}
2021-04-29 22:26:30 +00:00
else if (myStruct.myInt > 10)
2021-04-29 19:42:51 +00:00
{
myStruct.Decrement();
}
2021-04-29 22:26:30 +00:00
else
{
myStruct.myInt = 4;
}
2021-04-29 04:25:25 +00:00
2021-05-16 07:23:52 +00:00
Console.PrintLine("%i", myStruct.myInt);
return 0;
2021-04-28 23:01:48 +00:00
}
}