Files
carbon-lang/utils/textmate/Samples/main.carbon
T
Richard Smith 4daaa4866f Rename Type -> type, per #2360. (#2507)
Also make minor updates to the skeletal design in
docs/design/name_lookup.md following #2113, as there are no longer any prelude names that are made available to unqualified name lookup by default.

Add `type` to the keyword list in
docs/design/lexical_conventions/words.md, following #2360.
2023-01-04 14:22:30 -08:00

47 lines
884 B
Plaintext

// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
// More single line comments
package Carbon api;
interface HasValueParam(T:! type, V:! T) {
fn Go[self: Self]() -> T;
}
impl () as HasValueParam(i32, 5) {
fn Go[self: Self]() -> i32 { return 42; }
}
class Point {
fn Origin() -> Self {
return {.x = 0, .y = 0};
}
var x: i32;
var y: i32;
}
fn Procedure() -> i32 {
returned var zoop: i32 = 0;
while (DoSomeJob() {
zoop += 1;
}
return var;
}
fn Main() -> i32 {
let str = "Hello world";
let hex = 0xABCDEF1234567890;
let bin = 0b0000111001010010;
let dec = 123456789012345678;
let big: Carbon.Int(1024) = 1234;
let aaa: auto = "Carbon";
let view: StringView = "Carbon";
return Procedure();
}