Permalink
Browse files

Add S02.md

  • Loading branch information...
c9s committed May 6, 2012
1 parent 429d29e commit 767d911ffd01c939e2b0f7646ca94cc0d2f044d0
Showing with 46 additions and 1 deletion.
  1. +46 −0 doc/synopsis/S02.md
  2. +0 −1 doc/synopsis/S06.md
View
@@ -0,0 +1,46 @@
+Bits and Pieces
+===============
+
+## Variable
+
+### Integer, Float and Double
+
+ foo = 123
+ foo2 = 1.23
+
+### String
+
+ bar = '123'
+
+### String interpolation
+
+ person = 'John'
+ template = "Hi, {{ person }}. Good morning."
+
+will be transformed into:
+
+ <?
+ $person = 'John';
+ $template = 'Hi, ' . $person . '. Good morning.';
+
+## Hash (Associative Array)
+
+ list = 1..10
+
+ $list = range(1,10);
+
+ list = [1,2,3]
+ list[] = 4
+ list[] = 5
+ list[] = 6
+
+
+ zoo = "hack"
+ addresses = {
+ "foo" => 1,
+ :bar => 2,
+ zoo => 3,
+ }
+ addresses[:john] = 3
+
+NOTE, we have to solve the use of inserting hash with key by variable.
View
@@ -126,7 +126,6 @@ To define a PHP class with inheritance:
new: ->
-
## Interface
To implement an interface for a class:

0 comments on commit 767d911

Please sign in to comment.