Skip to content

Commit

Permalink
Improve documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey Antukh committed Dec 25, 2013
1 parent 54cff99 commit e3fa93f
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,66 @@ Javascript:
}
While loop
~~~~~~~~~~

CobraScript/Python:

.. code-block:: python
while 2 > a:
console.log(1)
Javascript:

.. code-block:: js
while (2 > a) {
console.log(1);
}
Decorators
~~~~~~~~~~

CobraScript/Python:

.. code-block:: python
def debug(func):
def _decorator():
console.log("call....")
return func.apply(null, arguments)
return _decorator
@debug
def sum(a1, a2, a3):
return a1 + a2 + a3
console.log(sum(1,2,3))
Javascript:

.. code-block:: js
var debug, sum;
debug = function(func) {
var _decorator;
_decorator = function() {
console.log("call....");
return func.apply(null, arguments);
};
return _decorator;
};
sum = function(a1, a2, a3) {
return (a1 + a2) + a3;
};
sum = debug(sum);
console.log(sum(1, 2, 3));
Operators
~~~~~~~~~

Expand Down

0 comments on commit e3fa93f

Please sign in to comment.