aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-10-13 12:38:23 +0100
committergingerBill <bill@gingerbill.org>2019-10-13 12:38:23 +0100
commit2a6d9e8927ad1eb1e5f3a79fc9ed068a02cbfdfc (patch)
tree1e771afe3e07425e536b3519818306a6d4e022ff /examples
parentfa81061db0d08a508ab8bbedfcf7bf5ad1e27daa (diff)
`#panic`; Minor change to demo.odin; Fix `#assert` bug at file scope
Diffstat (limited to 'examples')
-rw-r--r--examples/demo/demo.odin20
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/demo/demo.odin b/examples/demo/demo.odin
index ff861b1de..5ee9ded84 100644
--- a/examples/demo/demo.odin
+++ b/examples/demo/demo.odin
@@ -28,9 +28,9 @@ when os.OS == "windows" {
Answers to common questions about Odin.
*/
-@(link_name="general_stuff")
-general_stuff :: proc() {
- fmt.println("# general_stuff");
+@(link_name="extra_general_stuff")
+extra_general_stuff :: proc() {
+ fmt.println("# extra_general_stuff");
{ // `do` for inline statements rather than block
foo :: proc() do fmt.println("Foo!");
if false do foo();
@@ -209,8 +209,8 @@ union_type :: proc() {
}
}
- Vector3 :: struct {x, y, z: f32};
- Quaternion :: struct {x, y, z, w: f32};
+ Vector3 :: distinct [3]f32;
+ Quaternion :: distinct quaternion128;
// More realistic examples
{
@@ -320,17 +320,17 @@ union_type :: proc() {
/*
Entity :: struct {
- ..
+ ...
derived: union{^Frog, ^Monster},
}
Frog :: struct {
using entity: Entity,
- ..
+ ...
}
Monster :: struct {
using entity: Entity,
- ..
+ ...
}
new_entity :: proc(T: type) -> ^Entity {
@@ -539,7 +539,7 @@ parametric_polymorphism :: proc() {
fmt.println(r);
r = 123;
fmt.println(r);
- r = Error.Foo0;
+ r = Error.Foo0; // r = .Foo0; is allow too, see implicit selector expressions below
fmt.println(r);
}
@@ -1190,7 +1190,7 @@ where_clauses :: proc() {
main :: proc() {
when true {
- general_stuff();
+ extra_general_stuff();
union_type();
parametric_polymorphism();
threading_example();