viernes, 18 de septiembre de 2015

My first post on Falcon

I discovered Falcon a couple of months ago...but didn't have the time to start playing with it...


Falcon is an open source, multi-paradigm programming language. While it looks like a new programming language, it's actually kind of old having it's first appearance on 2003...

Syntactically, it's pretty similar to Lua...which means is kind of similar to Go or C++...but of course it has some pretty and unique cool features -;)

For now...I just ported my Lua version of the Fibonacci Numbers...and beside the fact that Falcon doesn't use "then" and the fact that Falcon can't concatenate numbers with string (but can concatenate string with numbers)...the code is pretty much the same...

Let's see how it goes when I code my LED Numbers app -;)

Here's the code...

fibonacci.fal
function fib(num,a,b)
 result = ""
 if a > 0 and num > 1
  result = result + (a+b) + " " + fib(num-1,a+b,a)
 elif a == 0
  result = "" + a + " " + b + " " + (a+b) + " " + fib(num-1,a+b,b)
 end
 return result 
end

print("Enter a number: ")
num = int( input() )
print(fib(num,0,1))

Here's the result...



Greetings,

Blag.
Development Culture.

No hay comentarios: