Skip to content

Instantly share code, notes, and snippets.

@Oluwasetemi
Last active May 31, 2020 14:08
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 Oluwasetemi/1e3d094b5efa2987959995cd7ab77c21 to your computer and use it in GitHub Desktop.
Save Oluwasetemi/1e3d094b5efa2987959995cd7ab77c21 to your computer and use it in GitHub Desktop.
Hello World Examples updated
class HelloWorld {
constructor(name) {
this.name = name.toUpperCase();
}
sayHi() {
console.log(`Hello ${this.name}!`)
};
}
const hello = new HelloWorld('ade');
hello.sayHi();
class HelloWorld:
def __init__(self, name):
self.name = name.capitalize()
def sayHi(self):
print "Hello " + self.name + "!"
hello = HelloWorld("world")
hello.sayHi()
class HelloWorld
def initialize(name)
@name = name.capitalize
end
def sayHi
puts "Hello !"
end
end
hello = HelloWorld.new("World")
hello.sayHi
Run `node hello_world.js` to print Hello Ade!
Run `python hello_world.py` to print Hello World
Run `ruby hello_world.rb` to print Hello World
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment