Mostrando entradas con la etiqueta Zonnon. Mostrar todas las entradas
Mostrando entradas con la etiqueta Zonnon. Mostrar todas las entradas

viernes, 31 de julio de 2015

LED is my new Hello World - Zonnon Time

You knew this was coming...don't you? -;)

So here...I took another approach because Zonnon doesn't have a built-in split command...and also because I'm not sure how to create an array of arrays and because I couldn't make my procedure return an array and then assign it to another array -:(

Still...I'm quite happy with the result -:D

LED_Numbers.znn
module LED_Numbers;

var num, text, concat:string;
var leds:array 10 of string;
var led:array 3 of string;
var i, j, z, len, lenled:integer; 

begin
 leds[0]:=" _  ,| | ,|_| ,";
 leds[1]:="  ,| ,| ,";
 leds[2]:=" _  , _| ,|_  ,";
 leds[3]:="_  ,_| ,_| ,";
 leds[4]:="    ,|_| ,  | ,";
 leds[5]:=" _  ,|_  , _| ,";
 leds[6]:=" _  ,|_  ,|_| ,";
 leds[7]:="_   , |  , |  ,";
 leds[8]:=" _  ,|_| ,|_| ,";
 leds[9]:=" _  ,|_| , _| ,";
 write("Enter a number: ");readln(num);
 len:=num.Length;
 for j:=0 to len - 1 do
  i:=0;
  text:=leds[integer(num[j])-48];
  lenled:=text.Length;
  for z:= 0 to lenled - 1 do
   if text[z] # "," then
    concat:= concat + string(text[z]);
   else
    led[i]:=led[i] + concat;
    concat:="";
    i:= i + 1;
   end;
  end;
 end; 
 writeln(led[0]);
 writeln(led[1]);
 writeln(led[2]);
end LED_Numbers.

Anyway...here are the pictures -;)



Greetings,

Blag.
Development Culture.

My first post on Zonnon

As always...I was looking for new and cool programming languages to learn...and then Mark Teichmann came up with something really nice -;) The Zonnon programming language...

So...what's Zonnon? Zonnon is a general-purpose programming language in the Pascal, Modula-2 and Oberon family...and it's run on .NET/Mono...

It's been a really long time since I used Pascal or Delphi...but...just like riding a bicycle...the knowledge came back as soon I started writing some code -;)

Now...the only problem I have with Zonnon...is that's there's almost no documentation...and what's available is in Russian...so...a lot Google helped me up...


Here's the Fibonacci Numbers app...


Fibo.znn
module Fibo;
var num: integer;
var a, b: integer;

procedure fib (var num, a, b : integer): string;
var result: string;
var ab: integer;
begin
 result := "";
 if (a > 0) & (num > 1) then
  num := num - 1;
  ab := a + b;
  result := result + string(ab) + " " + fib(num, ab, a);
 elsif a == 0 then
  num := num - 1;
  ab := a + b;
  result := string(a) + " " + string(b) + " " + string(ab) + " " + fib(num, ab, b);
 end;
 return result;
end fib;

begin
 a := 0;
 b := 1;
 write("Enter a number: ");readln(num);
 writeln(fib(num,a,b));
 writeln("");
end Fibo.

And a couple of pictures...




I need to keep playing and exploring Zonnon...there's a lot of cool things still hiding from me -;)

Greetings,

Blag.
Development Culture.