This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-02-07 15:24:34

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Dart

I just heard about this but...
It's a web language being developed by Google.
http://en.wikipedia.org/wiki/Dart_(programming_language)


Would you want it to replace JavaScript (which is it future goal)?

It looks a lot like C or Java.

Code:

//this is "Hello World" program
main() {
  print('Hello World!');
}

According to Wikipedia, this is a Fibbonaci sequence in it.

Code:

int fib(int n) => (n > 1) ? (fib(n - 1) + fib(n - 2)) : n;
main() {
  print('fib(20) = ${fib(20)}');
}

What are your thoughts???


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#2 2013-02-07 15:52:08

Zeusking19
Scratcher
Registered: 2011-07-10
Posts: 1000+

Re: Dart

*groan*

More Fibbonaci?

We learnt that in maths.

Never again.


http://i49.tinypic.com/2w7e1jm.pnghttp://dragcave.net/image/eFGFz.gifhttp://dragcave.net/image/9hE5q.gif

Offline

 

#3 2013-02-07 16:03:53

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Dart

Zeusking19 wrote:

*groan*

More Fibbonaci?

We learnt that in maths.

Never again.

I made my own in Javascript

I guess this one is a ton shorter

Code:

//javascript version
var a = 0;
var b = 0; 
var c = 0; 
var d = new Array(); 
var arrayCounter
d[0] = 0;
d[1] = 1;

function fib(){
arrayCounter = (d.length - 1);
a = d[arrayCounter];
b = d[(arrayCounter - 1)];
c = (a + b)
arrayCounter = (d.length);
d[arrayCounter] = c;
console.log(d)
}
for (i = 0; i < 10; i++) {
 fib() 
}

http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

Board footer