Skip to content

Commit

Permalink
Update syntax.md (#1035)
Browse files Browse the repository at this point in the history
Add a note about floor division support.
  • Loading branch information
zeux authored Sep 7, 2023
1 parent 105f54b commit bf1fb8f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/_pages/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,9 @@ This restriction is made to prevent developers using other programming languages
Luau currently does not support backtick string literals as a type annotation, so `` type Foo = `Foo` `` is invalid.

Function calls with a backtick string literal without parenthesis is not supported, so `` print`hello` `` is invalid.

## Floor division (`//`)

Luau implements support for floor division operator (`//`) for numbers as well as support for `__idiv` metamethod. The syntax and semantics follow [Lua 5.3](https://www.lua.org/manual/5.3/manual.html#3.4.1).

For numbers, `a // b` is equal to `math.floor(a / b)`; when `b` is 0, `a // b` results in infinity or NaN as appropriate.

0 comments on commit bf1fb8f

Please sign in to comment.