-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ba809a
commit 07c2fd4
Showing
10 changed files
with
164 additions
and
4 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
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
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,5 @@ | ||
require foo as bar_foo | ||
|
||
bar_foo.a = 101 | ||
print(bar_foo.fooInstance.age) | ||
|
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,25 @@ | ||
class Foo { | ||
a_ = nil | ||
b_ = nil | ||
|
||
def init(a, b) { | ||
self.a_ = a | ||
self.b_ = b | ||
} | ||
|
||
def foo() { | ||
print(a_ + b_) | ||
} | ||
|
||
def sumAB() { | ||
num = a_ + b_ | ||
return num + 1 | ||
print("shit") | ||
} | ||
} | ||
|
||
f = Foo.new(1, 2) | ||
f.foo() | ||
|
||
h = f.sumAB() | ||
print(h) |
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,4 @@ | ||
require bar as barrr | ||
|
||
a = 100 | ||
|
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,72 @@ | ||
print("test function") | ||
def fact(n) { | ||
f = 1 | ||
while n > 0 { | ||
f = f * n | ||
n = n - 1 | ||
} | ||
return f | ||
} | ||
result = fact(3) | ||
print("6 succes") | ||
|
||
print("test fib") | ||
def fib(n) { | ||
if n < 2 { | ||
return n | ||
} | ||
else { | ||
return fib(n - 1) + fib(n - 2) | ||
} | ||
} | ||
result = fib(10) | ||
print("55 success") | ||
|
||
print("test class") | ||
class Position { | ||
x = y = 0 | ||
|
||
def init() { | ||
|
||
} | ||
|
||
def move (nx, ny) { | ||
x = nx | ||
y = ny | ||
} | ||
} | ||
p = Position.new() | ||
p.move(3, 4) | ||
p.x = 10 | ||
print(p.x + p.y) | ||
print("14 success") | ||
|
||
if 1 > 2 { | ||
print ("1 > 2") | ||
} | ||
elif 3 < 2{ | ||
print ("3 < 2") | ||
} | ||
elif 3 < 2 { | ||
print ("3 < 2") | ||
} | ||
else { | ||
print ("else test successfully") | ||
} | ||
|
||
true = (1 < 2) | ||
false = (1 > 2) | ||
|
||
if or(true, false) { | ||
print("or test successfully"); | ||
} | ||
else { | ||
print("or test failed") | ||
} | ||
|
||
if and(true, false) { | ||
print("and test failed") | ||
} | ||
else { | ||
print("and test successfully") | ||
} |