Skip to content

Instantly share code, notes, and snippets.

@donatj donatj/examples.md
Last active Aug 7, 2017

Embed
What would you like to do?

TypeScript

class MyLogicContainer {
    constructor(private x: number) { }
    
    add(y: number) {
        return this.x + y;
    }
}

JavaScript

var MyLogicContainer = (function () {
    function MyLogicContainer(x) {
        this.x = x;
    }
    MyLogicContainer.prototype.add = function (y) {
        return this.x + y;
    };
    return MyLogicContainer;
}());

PHP

<?php

class MyLogicContainer {
	protected $x;

	public function __construct($x) {
		$this->x = $x;
	}
    
	public function add($y) {
		return $this->x + $y;
	}
}

Go

type MyLogicContainer struct {
	x float64
}

func NewMyLogicContainer(x float64) *MyLogicContainer {
	return &MyLogicContainer{x: x}
}

func (m *MyLogicContainer) add(y float64) float64 {
	return m.x + y
}
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.