-
Notifications
You must be signed in to change notification settings - Fork 1
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 #5 from KDesp73/dev
Dev
- Loading branch information
Showing
29 changed files
with
577 additions
and
109 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
normal = "\033[0m" | ||
red = "\033[91m" | ||
green = "\033[92m" | ||
blue = "\033[94m" | ||
|
||
func print_red { | ||
echo red, _1, normal, "\n" | ||
} | ||
func print_blue { | ||
echo blue, _1, normal, "\n" | ||
} | ||
func print_green { | ||
echo green, _1, normal, "\n" | ||
} | ||
|
||
call print_red <- "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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
# This should be removed | ||
|
||
# | ||
# | ||
echo "hello # world\n" # this should be removed | ||
#echo "hello # world\n" # this should be removed | ||
# echo "hello # world\n" # this should be removed | ||
# echo "hello # world\n" # this should be removed | ||
|
||
if 1 { # Comment | ||
echo "Hello # world\n" | ||
} | ||
|
||
# This should be removed |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
func delay { | ||
echo "Started...\n" | ||
i = 100000 | ||
while i > 0 { | ||
i = i - 1 | ||
} | ||
echo "Finished\n" | ||
} | ||
|
||
call delay |
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
a = 5 | ||
|
||
if a == 2 { | ||
echo "a = 2\n" | ||
} else if a == 3 { | ||
echo "a = 3\n" | ||
} else if a == 4 { | ||
echo "a = 4\n" | ||
}else { | ||
echo "a is not 2 or 3 or 4\n" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
echo "n: ===\n===\n" | ||
echo "t: ===\t===\n" | ||
echo "\': ===\'===\n" | ||
echo "\": ===\"===\n" | ||
echo "r: ===\r===\n" | ||
echo "b: ===\b===\n" | ||
echo "f: ===\f===\n" | ||
echo "a: ===\a===\n" | ||
echo "v: ===\v===\n" | ||
echo "0: ===\0===\n" |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
size = 5 | ||
num = 1 | ||
i = 1 | ||
while i <= size { | ||
j = size | ||
while j > i { | ||
echo " " | ||
j = j - 1 | ||
} | ||
k = 0 | ||
while k < i*2-1 { | ||
echo num | ||
num = num + 1 | ||
k = k + 1 | ||
} | ||
num = 1 | ||
echo "\n" | ||
i = i + 1 | ||
} | ||
i = 1 | ||
while i <= size -1 { | ||
j = 0 | ||
while j < i { | ||
echo " " | ||
j = j + 1 | ||
} | ||
|
||
k = (size - i)*2-1 | ||
while k > 0 { | ||
echo num | ||
num = num + 1 | ||
k = k - 1 | ||
} | ||
num = 1 | ||
echo "\n" | ||
i = i + 1 | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
func method { | ||
echo _1, "\n" | ||
echo _2, "\n" | ||
echo _3, "\n" | ||
echo _4, "\n" | ||
echo _5, "\n" | ||
echo _25, "\n" | ||
echo _6, "\n" | ||
echo _7, "\n" | ||
echo _8, "\n" | ||
echo _9, "\n" | ||
} | ||
|
||
|
||
call method <- 1, 2.2, "Hello world", 1, 2 | ||
|
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,24 +1,30 @@ | ||
# Method to print a star pyramid of user defined height | ||
func print_pyramid { | ||
echo "Enter height: " | ||
height = val(input()) | ||
i = 1 | ||
while i <= height { | ||
spaces = height - i | ||
j = 1 | ||
while j <= _1 { | ||
spaces = height - j | ||
while spaces > 0 { | ||
echo " " | ||
spaces = spaces - 1 | ||
} | ||
|
||
stars = 2 * i - 1 | ||
stars = 2 * j - 1 | ||
while stars > 0 { | ||
echo "*" | ||
stars = stars - 1 | ||
} | ||
|
||
echo "\n" | ||
i = i + 1 | ||
j = j + 1 | ||
} | ||
} | ||
|
||
call print_pyramid <- x, 2, 3 | ||
echo "Enter height: " | ||
height = val(input()) | ||
|
||
i = 2 | ||
while i <= height{ | ||
echo "[", i, "]\n" | ||
call print_pyramid <- i | ||
i = i + 1 | ||
} |
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
a = 3 | ||
echo "global a: ", a, "\n" | ||
|
||
func scope_test { | ||
a = 1 | ||
echo "internal a: ", a, "\n" | ||
|
||
b = 2.3 | ||
|
||
echo "scope_test b: ", b, "\n" | ||
} | ||
|
||
func another { | ||
t = 32.19 | ||
s = "Hello" | ||
echo "t: ", t, " s: ", s, "\n" | ||
} | ||
|
||
call scope_test | ||
call another | ||
|
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
func delay { | ||
i = _1 | ||
while i > 0 { | ||
i = i - 1 | ||
} | ||
} | ||
|
||
func siren { | ||
while 1 { | ||
echo "\a." | ||
call delay <- 100 | ||
} | ||
} | ||
|
||
call siren |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
func println { | ||
echo _1, "\n" | ||
} | ||
|
||
func error { | ||
call println <- _1 | ||
exit _2 | ||
} | ||
|
||
#################################### | ||
|
||
call println <- "Hello" + " World" | ||
call error <- "Error message", 1 | ||
|
||
#################################### |
Oops, something went wrong.