Skip to main content

Further Examples

/* enum */
enum TempScale int64 {
  FAHRENHEIT = 0;
  CELSIUS = 1;
}

/* struct */
extensible struct WeatherData {
  temp : float64;
  scale : TempScale;
}

struct Position {
  latitude : float64;
  longitude : float64;
}

/* message */
message struct WeatherRecording extends WeatherData {
  time : int64;
  location : Position;
}

/* instance of a WeatherData */
WeatherData { temp = 32.0; scale = TempScale.FAHRENHEIT; }

/* instance of a Position */
Position { latitude = 0.0; longitude = 0.0; }

/* instance of a WeatherRecording */
WeatherRecording { 
  time = 1608352511431;
  location = Position {
    latitude = 0.0;
    longitude = 0.0;
  };
  temp = 32.0;
  scale = TempScale.FAHRENHEIT;
}