# include "Cello.h" int main (int argc, char argv) { var items=new (Array, Int, $ I (8), $ I (5), $ I (16, $ I (15), $ I (16), $ I (90)); / Iterate over indices using "range" / foreach (i in range ($ I (len (items)))) { print ("Item Range% i is% i n", i, get (items, i)); } / Iterate over every other item with "slice" / foreach (item in slice (items, _, _, $ I (2))) { print ("Item Slice% i n", item); } return 0; }
# include " Cello.h " / Define a normal C structure / struct Point { float x, y; }; / Make it compatible with Cello / var Point=Cello (Point); int main (int argc, char argv) { / Create on Stack or Heap / var p0=$ (Point, 0.0, 1.0); var p1=new (Point, $ (Point, 0.0, 2.0)); / It can be shown, compared, hashed, etc ... p0: p1: cmp: 1 hash: l / print ("p0:% $ np1:% $ ncmp:% i nhash:% ul n", p0, p1, $ I (cmp (p0, p1)), $ I (hash (p0))); / And collected by the GC when out of scope / return 0; }
F.A.Q
GIPHY App Key not set. Please check settings