How to make your Prime programs not dependent o...

Publicado el por

How to make your Prime programs not dependent of the HP Prime number settings

 

There is an undocumented function in HP Prime, very useful for us Central Europeans that insist on decimal comma instead of decimal point; and that had to move to decimal point if we wanted to be able to write programs that compile in all circumstances.

the line syntax is

Code:

#pragma mode( separator(.,;) integer(h64) )

This is telling the parser that, no matter what the calculator status is, you’re doing the programming with the following convention:

  • Decimal point (.)
  • Argument separator (,)
  • command separator (;)
  • integer type: 64 bit

To insert the PRAGMA, while in program editor, press “Menu” key and “5 insert pragma”. It has to be put before the start of any program, or it will give a syntax error.

You can now test your programs with European and American conventions in the Home settings, and see what happens!

Comentarios: 0
Más sobre: HP prime, pragma

Solo los usuarios registrados pueden poner comentarios.
Identificarse y añadir comentario Regístrese ahora