From 4370acd1bb89e96174424368ccb6b087615354a1 Mon Sep 17 00:00:00 2001 From: gleb Date: Fri, 17 Oct 2025 06:09:46 -0700 Subject: [PATCH] Snippets update (#6204) ~~Added explanatory comment about math package usage~~ Changed Main() entry point to Run() as per design and toolchain This small update of front page code snippets will add explanatory comment to highlight that provided Carbon code is hypothetical and meant to show the look and feel of the language. Also it delivers change of Main() to Run() to highlight correct entry point for Carbon lang. --- README.md | 3 +++ docs/design/expressions/literals.md | 2 +- docs/images/carbon_snippet.svg | 2 +- docs/images/snippets.md | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8c74e34099c8..4a2edc6f84d6 100644 --- a/README.md +++ b/README.md @@ -169,6 +169,9 @@ If you're already a C++ developer, Carbon should have a gentle learning curve. It is built out of a consistent set of language constructs that should feel familiar and be easy to read and understand. +The Carbon code here is hypothetical and meant to show the look and feel of the +language. + C++ code like this: diff --git a/docs/design/expressions/literals.md b/docs/design/expressions/literals.md index 009a02060c7d..6712ef122da1 100644 --- a/docs/design/expressions/literals.md +++ b/docs/design/expressions/literals.md @@ -226,7 +226,7 @@ fn Sum(x: i32, y: i32) -> i32 { return x + y; } -fn Main() -> i32 { +fn Run() -> i32 { return Sum(4, 2); } ``` diff --git a/docs/images/carbon_snippet.svg b/docs/images/carbon_snippet.svg index 4d2e3f84982e..f6f992717875 100644 --- a/docs/images/carbon_snippet.svg +++ b/docs/images/carbon_snippet.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/docs/images/snippets.md b/docs/images/snippets.md index eb6067c9edf3..dd338ba43ee2 100644 --- a/docs/images/snippets.md +++ b/docs/images/snippets.md @@ -98,7 +98,7 @@ fn PrintTotalArea(circles: [Circle]) { Print("Total area: {0}", area); } -fn Main() -> i32 { +fn Run() -> i32 { // A dynamically sized array, like `std::vector`. var circles: array [Circle] = ({.r = 1.0}, {.r = 2.0}); // Implicitly constructs a slice from the array.