diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2023-11-27 21:01:27 +0100 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2023-11-27 21:01:27 +0100 |
| commit | 4aa8834d392d65da1eb55b5c600bf8d4030d0e80 (patch) | |
| tree | c2a0d16cff3d869f3e3f4eb3081dc1d9404fbdd5 /examples | |
| parent | f79efd43e44ae74bfae098d49bf9c5b2876eda5d (diff) | |
Add os.args to demo.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/demo/demo.odin | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/demo/demo.odin b/examples/demo/demo.odin index 00dd8a171..417011281 100644 --- a/examples/demo/demo.odin +++ b/examples/demo/demo.odin @@ -44,7 +44,13 @@ the_basics :: proc() { fmt.println("\n# the basics") { // The Basics - fmt.println("Hellope") + + // os.args holds the path to the current executable and any arguments passed to it. + if len(os.args) == 1 { + fmt.printf("Hellope from %v.\n", os.args[0]) + } else { + fmt.printf("%v, %v! from %v.\n", os.args[1], os.args[2], os.args[0]) + } // Lexical elements and literals // A comment |