Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System.Console;
using Nemerle.Imperative.GoTo; // It need for 'goto' and 'label' macros.
struct S
{
public mutable X : int;
public mutable Y : int;
}
module Program
{
Foo(s : S) : void { WriteLine($"s.X=$(s.X) s.Y=$(s.Y)"); }
Main() : void
{
for (mutable i = 0; i < 2; i++)
{
goto label_1;
mutable s;
label label_1;
s.X = i + 1;
Foo(s);
s.Y = 2;
}
_ = ReadLine();
}
}
// output:
// s.X=1 s.Y=0
// s.X=2 s.Y=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.