-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42136 from ShammiL/add-code
Change `bal add` generated code to adhere to best practices
- Loading branch information
Showing
4 changed files
with
10 additions
and
11 deletions.
There are no files selected for viewing
8 changes: 4 additions & 4 deletions
8
cli/ballerina-cli/src/main/resources/create_cmd_templates/lib/lib.bal
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
# Returns the string `Hello` with the input string name. | ||
# | ||
# + name - name as a string | ||
# + name - name as a string or nil | ||
# + return - "Hello, " with the input string name | ||
public function hello(string name) returns string { | ||
if !(name is "") { | ||
return "Hello, " + name; | ||
public function hello(string? name) returns string { | ||
if name !is () { | ||
return string `Hello, ${name}`; | ||
} | ||
return "Hello, World!"; | ||
} |
This file contains 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
This file contains 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
This file contains 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