mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-15 08:08:03 +01:00
32 lines
972 B
Plaintext
32 lines
972 B
Plaintext
class Foo {
|
|
+ other { "infix + " + other }
|
|
- other { "infix - " + other }
|
|
* other { "infix * " + other }
|
|
/ other { "infix / " + other }
|
|
% other { "infix % " + other }
|
|
< other { "infix < " + other }
|
|
> other { "infix > " + other }
|
|
<= other { "infix <= " + other }
|
|
>= other { "infix >= " + other }
|
|
== other { "infix == " + other }
|
|
!= other { "infix != " + other }
|
|
|
|
! { "prefix !" }
|
|
- { "prefix -" }
|
|
}
|
|
|
|
var foo = Foo.new
|
|
io.write(foo + "a") // expect: infix + a
|
|
io.write(foo - "a") // expect: infix - a
|
|
io.write(foo * "a") // expect: infix * a
|
|
io.write(foo / "a") // expect: infix / a
|
|
io.write(foo % "a") // expect: infix % a
|
|
io.write(foo < "a") // expect: infix < a
|
|
io.write(foo > "a") // expect: infix > a
|
|
io.write(foo <= "a") // expect: infix <= a
|
|
io.write(foo >= "a") // expect: infix >= a
|
|
io.write(foo == "a") // expect: infix == a
|
|
io.write(foo != "a") // expect: infix != a
|
|
io.write(!foo) // expect: prefix !
|
|
io.write(-foo) // expect: prefix -
|