aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-06-28 23:55:40 +0100
committerGinger Bill <bill@gingerbill.org>2017-06-28 23:55:40 +0100
commitfd81c06c35f1cca9153be9f78dc5ecc4ae503d0e (patch)
tree424db1c7df1f00f98b8042818681b8149cff01e1 /code
parent94afcec7577f24d7f027f72765928e6dc5738234 (diff)
Remove `var` and `const` keywords; Fix default parameter syntax
Diffstat (limited to 'code')
-rw-r--r--code/demo.odin10
1 files changed, 5 insertions, 5 deletions
diff --git a/code/demo.odin b/code/demo.odin
index 6e0feea04..ee0504de8 100644
--- a/code/demo.odin
+++ b/code/demo.odin
@@ -125,8 +125,8 @@ named_arguments :: proc() {
// Named arguments can also aid with default arguments
- numerous_things :: proc(s: string, a = 1, b = 2, c = 3.14,
- d = "The Best String!", e = false, f = 10.3/3.1, g = false) {
+ numerous_things :: proc(s: string, a := 1, b := 2, c := 3.14,
+ d := "The Best String!", e := false, f := 10.3/3.1, g := false) {
g_str := g ? "true" : "false";
fmt.printf("How many?! %s: %v\n", s, g_str);
}
@@ -147,7 +147,7 @@ named_arguments :: proc() {
default_return_values :: proc() {
- foo :: proc(x: int) -> (first: string = "Hellope", second = "world!") {
+ foo :: proc(x: int) -> (first: string = "Hellope", second := "world!") {
match x {
case 0: return;
case 1: return "Goodbye";
@@ -178,7 +178,7 @@ default_return_values :: proc() {
id: u32,
}
- some_thing :: proc(input: int) -> (result: ^Entity = nil, err = Error.None) {
+ some_thing :: proc(input: int) -> (result: ^Entity = nil, err := Error.None) {
match {
case input == 3: return err = Error.WhyTheNumberThree;
case input >= 10: return err = Error.TenIsTooBig;
@@ -192,7 +192,7 @@ default_return_values :: proc() {
}
call_location :: proc() {
- amazing :: proc(n: int, using loc = #caller_location) {
+ amazing :: proc(n: int, using loc := #caller_location) {
fmt.printf("%s(%d:%d) just asked to do something amazing.\n",
fully_pathed_filename, line, column);
fmt.printf("Normal -> %d\n", n);