Last active
June 2, 2019 20:26
-
-
Save wallabra/86c2ae8fa64e9ad4e9fb8a376ef52cb1 to your computer and use it in GitHub Desktop.
Fre works!
This file contains hidden or 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
func int() PrintBottles(int bottles, float* myPointer, int%* iterListPtr) { | |
int iters; | |
while (> bottles, 0) { | |
array:append(*iterListPtr, bottles); | |
print(+ "There are ", (+ (set bottles, (- bottles, 1)), 1), " bottles on the wall! Take one, "); | |
set iters, + iters, 1; | |
set *myPointer, (* *myPointer, 2); | |
if (> bottles, 0) print(+ "there are ", bottles, " to go! \n"); | |
else print("there are no more!\n\n"); | |
} | |
func int printIters() { | |
print(+ iters, " bottles were taken.\n"); | |
} | |
return printIters; | |
} | |
func void main() { | |
int() printer; | |
int% iterList; | |
float myFloat; | |
set myFloat, 1.5; | |
set printer, (* PrintBottles(10, @myFloat, @iterList), 2); | |
printer(); | |
print(+ "\n(Final float: ", myFloat, ", final list: ", iterList, ")\n\n"); | |
} | |
main(); |
This file contains hidden or 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
There are 10 bottles on the wall! Take one, there are 9 to go! | |
There are 9 bottles on the wall! Take one, there are 8 to go! | |
There are 8 bottles on the wall! Take one, there are 7 to go! | |
There are 7 bottles on the wall! Take one, there are 6 to go! | |
There are 6 bottles on the wall! Take one, there are 5 to go! | |
There are 5 bottles on the wall! Take one, there are 4 to go! | |
There are 4 bottles on the wall! Take one, there are 3 to go! | |
There are 3 bottles on the wall! Take one, there are 2 to go! | |
There are 2 bottles on the wall! Take one, there are 1 to go! | |
There are 1 bottles on the wall! Take one, there are no more! | |
10 bottles were taken. | |
10 bottles were taken. | |
(Final float: 1536.0, final list: [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment