Skip to content

Instantly share code, notes, and snippets.

@pramodya1994
Created November 16, 2021 11:36
Show Gist options
  • Save pramodya1994/65ec2f91b57ab529f392cb5d366953bc to your computer and use it in GitHub Desktop.
Save pramodya1994/65ec2f91b57ab529f392cb5d366953bc to your computer and use it in GitHub Desktop.
new main.bal
# Prints `Hello` with input string name.
#
# + name - the input sting name
# + return - "Hello " with the input string name
public function sayHello(string name) returns string {
if !(name is "") {
// We are adding "!" in the end and remove "," after hello as a bug fix.
return "Hello " + name + "!";
}
return "Hello, World!";
}
# Prints `Bye` with input string name.
#
# + name - the input sting name
# + return - "Bye" with the input string name
public function sayBye(string name) returns string {
if !(name is "") {
return "Bye " + name + "!";
}
return "Bye, World!";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment