Last active
December 25, 2015 18:16
-
-
Save woodie/fb4aeaec6d1bdf0137df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env typescript | |
class Greeter { | |
name: string; | |
constructor(name?: string) { | |
this.name = name || 'Nobody'; | |
} | |
say_hello() { | |
console.log("Hello " + this.name); | |
} | |
} | |
var greeter = new Greeter(); | |
greeter.say_hello(); | |
var greeter = new Greeter('There'); | |
greeter.say_hello(); | |
/* | |
Hello Nobody | |
Hello There | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment