FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
lpython/tests/parser/function_def1.py at main · matthijsb/lpython · GitHub
matthijsb
/
lpython
Public
forked from
lcompilers/lpython
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
lpython
/
tests
/
parser
/
function_def1.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
62 lines (49 loc) · 1.02 KB
Breadcrumbs
lpython
/
tests
/
parser
/
function_def1.py
Copy path
File metadata and controls
62 lines (49 loc) · 1.02 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
from
lpython
import
i32
,
overload
def
greet
(
name
):
"""
This function greets to
the person passed in as
a parameter
"""
print
(
"Hello, "
+
name
+
". Good morning!"
)
def
absolute_value
(
num
):
"""This function returns the absolute
value of the entered number"""
if
num
>=
0
:
return
num
else
:
return
-
num
def
combine
(
fname
,
lname
):
print
(
fname
+
" "
+
lname
)
def
tri_recursion
(
k
):
if
(
k
>
0
):
result
=
k
+
tri_recursion
(
k
-
1
)
print
(
result
)
else
:
result
=
0
return
result
@
overload
def
test
(
a
:
i32
)
->
i32
:
return
a
+
10
@
overload
# Comment
def
test
(
a
:
i64
)
->
i64
:
return
a
+
10
@
overload
def
test
(
a
:
bool
)
->
i32
:
if
a
:
return
10
return
-
10
def
check
():
greet
(
"Xyz"
)
print
(
absolute_value
(
2
))
combine
(
"LPython"
,
"Compiler"
)
print
(
"Recursion Example Results: "
)
tri_recursion
(
6
)
print
(
test
(
15
))
print
(
test
(
True
))
check
()
def
print_args
(
*
args
):
print
(
args
)
def
print_kwargs
(
**
kwargs
):
print
(
kwargs
)
Back
|
FazBrowse Home
|
New Git URL