neilsf / xc-basic3

A BASIC cross compiler for MOS 6502-based machines
MIT License
44 stars 5 forks source link

[documentation] A very useful method of declaring multiple variables on a single line is not documented #237

Closed JJFlash-IT closed 1 year ago

JJFlash-IT commented 1 year ago

I am studying the example programs recently featured in XCB's Showcase (3D Labyrinth and Pacman), and I just saw that the compiler accepts a very neat way of declaring multiple variables - even of different types - on a single line.

You can do this:

DIM pacman AS AGENT, collChar AS BYTE, location AS WORD, number AS INT

I browsed the whole 3.x documentation, and I can't seem to find any reference to that.

This is quite useful because it matches the QuickBASIC & FreeBASIC way of doing the same thing, so any text editor's lexer which is based on those can parse a line like that just fine.

Specifically, Geany - the editor I use - can parse that line perfectly, while a line like this:

DIM pacman AS AGENT : DIM collChar AS BYTE : DIM location AS WORD : DIM number AS INT

makes it pick up only the first variable and doesn't "index" the rest.

neilsf commented 1 year ago

Ooops, thanks for reminding me. Initially, I didn't document this feature because it didn't work well. But I fixed the bug later, just forgot to add the documentation :-) Will do.