Please disable your ad-blocker to access the content


Carbon Programming Language: New Programming Language Google

Home » Programming Language » Carbon » Carbon Programming Language: New Programming Language Google
carbon programming language from google


Google has announced a new programming language called Carbon. The Carbon release date is 19 July 2022. Carbon is a general-purpose programming language that was created at Google to be a C++ successor language. A Googler named Chandler Carruth introduced developers to the new programming language called Carbon.

Chandler Carruth, the technical lead for Google programming languages, told us that they would be starting this experimental work with the C++ community. The language will be designed and developed on GitHub.

Why Build Carbon?

C++ remains the dominant programming language for performance-critical software. However, it is struggling to improve and meet developer’s needs, as outlined above, in not above part due to accumulating decades of technical debt and challenges with its evolution process. The best way to address these problems is to avoid inheriting the legacy of C or C++, instead start with solid language foundation such as modern generics system, modular code organization, consistent and simple syntax.

Carbon is fundamentally a successor language approach, rather than an attempt to incrementally evolve C++. A successor language for C++ requires:

  • Performance matching C++, an essential property for our developers.
  • Seamless, bidirectional interoperability with C++, such that a library anywhere in an existing C++ stack can adopt Carbon without porting the rest.
  • A gentle learning curve with reasonable familiarity for C++ developers.
  • Comparable expressivity and support for existing software’s design any architecture.
  • Scalable migration, with some level of source-to-source translation for idiomatic C++ code.

There are a few languages, that have followed this model for other ecosystems, and Carbon aims to fill an analogous role for C++:

  • JavaScript -> TypeScript
  • Java -> Kotlin
  • C++ -> Carbon

Language Goals

They are designing Carbon to support:

  • Performance-critical software
  • Software and language evolution
  • Code that is easy to read, write and understand.
  • Practical safety and testing mechanisms
  • Fast and scalable development
  • Modern OS platforms, hardware architectures, and environments
  • Interoperability with and migration from existing C++ code

Carbon Language is currently an experimental project. There is no working compiler or toolchain. You can see the demo interpreter for Carbon on

Code Example

package sample api;

fn HelloWorld(t: String) -> String {
    var txt: String;
    if (t == "") {
        txt = "Hello World From Carbon!";
    } else {
        txt = t;
    return txt;

fn Main() -> i32 {
  var p: String = "Let's See What it will Print";
  p = HelloWorld(p);
  var x: i32 = 1;
  var y: i32 = 2;
  var temp: i32 = x;
  x = y;
  y = temp;

  Print("x: {0}", x);
  Print("y: {0}", y);


  //i32 data type
  var arr: [i32;10] = (1,2,3,4,5,6,7,8,9,10);
  for (a: i32 in arr) {
      Print("Value {0}",a);

  //  String data type
  var arr2: [String;10] = ("1","2","3","4","5","6","7","8","9","10");
  for (a2: String in arr2) {

  var l: i32 = 10;
  var i: i32 = 1;
  while (i < l) {
      if (i % 2 == 0) {
          Print("{0} is EVEN",i);
      } else{
          Print("{0} is ODD",i);
    i = i + 1;

    // i++ or ++i
    // I should mention that in my case I couldn’t 
    // use while(x < 3) nor ++x. In both cases, 
    // I would get an error despite that syntax being 
    // proposed in the
    // error
    // SYNTAX ERROR: <source>:54: syntax error, unexpected PLUS
    // Compiler returned: 1

  return 0;

You can learn more about carbon programming languages syntax from docs

your comments are appreciated and if you wants to see your articles on this platform then please shoot a mail at this address

Thanks for reading 🙂