Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
nikeedev committed Sep 27, 2024
1 parent d5bfa49 commit e89566f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions language_syntax.rain
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ println(a); // > Vector2 { x: 6, y: 5 }

// Functions for structs:

Vector2 : magnitude :: () {
Vector2: magnitude: () {
return int(sqrt(this.x * this.x + this.y * this.y));
}

Expand All @@ -102,11 +102,11 @@ println(a.magnitude()); // > 7.8

// Create a fiber like this:
foo :: fiber {
println("Fiber called");
return "Fiber called";
}

// And call it:
foo.call(); // > "Fiber called!"
println(foo.call()); // > "Fiber called!"

// Yielding:

Expand Down Expand Up @@ -206,8 +206,10 @@ for i <= 100 {
println(sum); // > 5050



/// References and heap

x := 6;



0 comments on commit e89566f

Please sign in to comment.