Given a positive number N, my print_even() function prints out all the even numbers between 1 and N:
print_even(N) when N>0 -> even_helper(1, N).
even_helper(Current, N) when Current =< N ->
io:format("(Current = ~w)~n", [Current]),
case Current rem 2 of
0 -> io:format("Number: ~p~n", [Current]);
_ -> do_nothing
even_helper(Current, N) when Current > N ->
I need to write some modules that load data one time and then provide an interface to that data. I’d like to load the data asynchronously. My application already uses promises. Is providing a promise as the result of requiring a module a valid pattern/idiom?
I’m developing a game in HTML5 Canvas using phonegap and was wondering how to implement a “save game” and “load game” functions to a local text file, which are cross platform to both Android and iOS? Thanks!