by Jon D Goodwin
Cone is a fast, fit, friendly, and safe systems programming language

Design Goals:

  • 3D web support
  • "Do-it-your-way" memory management
  • Flexible typing & code reuse
  • Concise, readable code
  • Memory, thread & type safe
  • Lean, native runtime
struct Counter
	_count u32	// Private field, because of initial underscore

	// Initializer needed due to private field
	fn init(new self &)
		_count = 0u

	// Allow struct calling, overriding call operator `()`
	fn `()`() u32
		++_count

	// Reset counter, with 0 as default start
	fn reset(start = 0u)
		_count = start

fn counting()
	mut counter = Counter()
	imm one = counter()
	imm two = counter()
	counter.reset
	imm anotherone = counter()
Information updated 02/01/19
Note: This entry has not yet been moderated.
View Comments