Wiki

Changes between Version 16 and Version 17 of C

Show
Ignore:
Timestamp:
06/10/12 09:35:21 (13 years ago)
Author:
Charles
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • C

    v16 v17  
    1 === Cobra Differences From C# === 
     1= Cobra Differences From C# = 
    22 
    3 See also [http://cobra-language.com/forums/viewtopic.php?f=4&t=15 Cobra Forums Differences with C#] 
     3== Illustrated == 
     4 
     5{{{ 
     6#!cobra 
     7# Cobra 
     8d = {'a': 1, 'b': 2} 
     9assert d['a'] == 1 and d['b'] == 2 
     10for key, value in d 
     11    print '[key] = [value]'  # string interpolation 
     12}}} 
     13 
     14{{{ 
     15// C# 
     16var dictionary = new Dictionary<string, int> { {"a", 1}, {"b", 2} }; 
     17Assert.IsTrue(dictionary["a"] == 1 && dictionary["b"] == 2); 
     18foreach (var key in dictionary.Keys) 
     19{ 
     20   var value = dictionary[key]; 
     21   Debug.WriteLine(string.Format("{0} == {1}", key, value)); 
     22} 
     23}}} 
     24 
     25credit: http://fir3pho3nixx.blogspot.com/2011/01/when-c-is-not-enough.html 
     26 
     27 
     28== Quick Reference == 
    429 
    530 * Dynamic Typing and Type inference (doesnt require Type or keyword to declare locals) 
     
    86111 * more as they surface 
    87112 
    88 See also: 
     113== See also == 
     114 
     115 * [http://cobra-language.com/forums/viewtopic.php?f=4&t=15 Cobra Forums Differences with C#] 
    89116 * http://cobra-language.com/how-to/