Files
carbon-lang/utils/textmate/Samples/main.carbon
T
josh11b 9c8fd6864e Implement rename me -> self (#2444)
Implements change proposed in #1382

Replaces #1624
2022-12-06 20:17:00 -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();
}