Hello,
in the documentation I see the assignment to vars without spaces.
var person : cs.Person
person=cs.Person.new() //create the new instance
//Class: Person.4dm
constructor(firstname : string, lastname : string, age : integer)
this.firstName=firstname
this.lastName=lastname
this.age=age
Can I use this format?
var person : cs.Person
person = cs.Person.new() //create the new instance
//Class: Person.4dm
constructor(firstname : string, lastname : string, age : integer)
this.firstName = firstname
this.lastName = lastname
this.age = age
For me the code is better readable.
Will a fromater accept both versions?
Thank you for your feedback, yes it’s acceptable to format the code.
You can also format the whole code by clicking right of your mouse and choose “Format Document”, and automatically your code will be formated with spaces.
Many coding styles favor minimal spacing around symbols like -> for concise, visually consistent code, improving readability through reduced whitespace, often termed spacing style rules.
In addition to the previous answer, you can locate Format Document in the Command Palette, along with other code editor commands. Access the Command Palette via two methods: right-click in the code editor window and select it or simply press F1.
I don’t see a visually constant code, using whitespaces everywhere in the code - what improves the readability - but only on one place the spaces are omitted. Mojo, Rust and Python as one of the most popular programming languages use this symbol with spaces.
For better comparison:
IMO the formatting in Python style looks a little better. (Note the closing colon before function body.) Bringing Qodly Script closer to Python syntax could be an advantage.