Skip to content

Commit

Permalink
added hello-world and if-else-statements source code
Browse files Browse the repository at this point in the history
  • Loading branch information
Carlos Eduardo Witte authored and Carlos Eduardo Witte committed Feb 20, 2024
1 parent 0a9590b commit 8950c03
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,6 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# VS Code workspace file
.code-workspace
8 changes: 8 additions & 0 deletions Developer.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"folders": [
{
"path": ".."
}
],
"settings": {}
}
7 changes: 7 additions & 0 deletions hello-world/main.mojo
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from python import Python

fn main() raises:
let py = Python.import_module('builtins')
let user_input = py.input('What is your name? ')

print('Hello World from Mojo,', user_input)
12 changes: 12 additions & 0 deletions if-else-statements/main.mojo
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from python import Python

fn main() raises:
let py = Python.import_module('builtins')
let user_input = atol(py.input('Give me a number:'))

if user_input >= 100:
print('Value is equal or above 100')
elif user_input < 100 and user_input >50:
print('Value is betwenn 51 and 99')
else:
print('Value is equal or below 50')

0 comments on commit 8950c03

Please sign in to comment.