Files
carbon-lang/explorer/testdata/optional/init_optional_with_value.carbon
T
c096d010b9 Optional Class (#2096)
Adding Optional class to prelude...
I hope it is useful!

Co-authored-by: m new <michael.burzan@outlook.de>
Co-authored-by: Richard Smith <richard@metafoo.co.uk>
Co-authored-by: Geoff Romer <gromer@google.com>
2022-09-09 11:15:17 -07:00

23 lines
692 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
//
// RUN: %{explorer} %s 2>&1 | \
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes=false %s
// RUN: %{explorer} --parser_debug --trace_file=- %s 2>&1 | \
// RUN: %{FileCheck} --match-full-lines --allow-unused-prefixes %s
// AUTOUPDATE: %{explorer} %s
// CHECK: Hallo Welt
// CHECK: result: 0
package ExplorerTest api;
fn Main() -> i32{
var x: Optional(String) = Optional(String).Create( "Hallo Welt" );
if(x.HasValue()){
Print(x.Get());
return 0;
}
return -1;
}