Be aware that some EV3 Basic programs that run perfectly in 'PC mode' (launched within Small Basic) will not compile correctly to the brick and therefore cannot be run in 'Brick mode' (launched from within the brick's menus). Sometimes the reason is obvious: of course brick mode will not work if the program makes use of Small Basic's graphic window or text window or tries to play sounds on the PC's speaker. Sometimes the reason is less obvious, caused by programming practices that are compatible with Small Basic but not with the compiler that tries to convert the Small Basic files into the RBF format that the brick understands. Here are some tips to minimise the risk of problems occurring when you try to compile your programs so that they can be run in brick mode:
The above program runs fine in PC mode but will not compile for download to the brick. Why? Because the method used to make the array called 'Colors' is not acceptable to the compiler. So the solution, which CAN be compiled to the brick and run in brick mode, is this:
'Make an array containing the colors, matched to the array index values
Further details, as explained by the developer:
The original behaviour of Small Basic has been mimicked in the EV3-compiler as faithfully as possible, but there are some things that simply can not be done with the EV3 byte code interpreter.
While Small Basic has just one datatype which is a Unicode string into which all possible values (even arrays) are mangled, EV3 Basic has 4 distinct datatypes for variables:
Every variable has one of these types (which is determined by its first use in the program code) and cannot be used to store anything else.
Arithmetic or logic operators need to be provided with either number or text parameters and deliver a result of also a defined type (for example, the "<" needs two numbers and delivers a text). One exception is the "=" which will perform either a numerical or a textual comparison, depending on the compile-time type of the operands. Another exception is the "+" that will do a numerical add when provided with two numbers, but will do a text concatenation if one of the operands is text. Similar requirements are there for function parameters, which also have a defined compile-time type. To make things easier, an automatic conversion from number to text is done if a parameter needs a text (but not the other way round).
Any text variable can only hold up to 251 characters and not the full Unicode range is supported, but only the codes 1 - 255 (they are just plain C-style char strings). The same holds for all elements of text arrays.