Skip to content

Instantly share code, notes, and snippets.

@VladD2
Created March 17, 2017 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VladD2/8cf390d3417b887ceab5216981feb3e4 to your computer and use it in GitHub Desktop.
Save VladD2/8cf390d3417b887ceab5216981feb3e4 to your computer and use it in GitHub Desktop.
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