|
Oktatás * Programozás 1 * Szkriptnyelvek Teaching • Programming 1 (BI) Félévek Linkek * kalendárium |
Nim2 /
Create a custom operator (operator overloading)See https://nim-lang.github.io/Nim/tut1.html#procedures-operators for more info about operators.
"Apart from a few built-in keyword operators such as To define a new operator, enclose the operator in backticks "`". func `%`(a, b: int): int = a mod b echo 10 % 3 # 1 𝥶Modulo is called proc `++`(x: var int) = inc x var a = 5 ++a echo a # 6 𝥶Similarly, there's no Honestly, I don't think it's a good idea to create your own |
![]() Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |