File: monkeyc.actual

package info (click to toggle)
golang-github-alecthomas-chroma 0.10.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports
  • size: 6,264 kB
  • sloc: python: 426; javascript: 79; sh: 32; makefile: 32
file content (47 lines) | stat: -rw-r--r-- 974 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using Toybox.Application as App;
using Toybox.System;

const PI = 3.14;

class MyProjectApp extends App.AppBase {
    protected var y;

    function initialize () {
        me.y = "Hello";
        self.y = "World";
        var x = add( 3, 4 );
        var array = new [x];

        // Initialize the sub-arrays
        for( var i = 0; i < x; i += 1 ) {
            array[i] = new [5];
        }

        var dict = { "a" => 1, "b" => 2 };
        var person = { :firstName=>"Bob", :lastName=>"Jones" };
    }

    public function onStart(state) {
        var v = new Foo();
        var m = v.method(:op);
        m.invoke(1,2l);
    }

    function getInitialView() {
        return [ new MyProjectView() ];
    }

    function add( a, b ) {
        return a + b;
    }

    function thisFunctionUsesAdd() {
        var a = add( 1, 0x03f ); // Return  4
        var b = add( "Hello ", "World" ); // Returns "Hello World"
    }
    
}

class Foo  {
    function op(a, b) {}
}