Jaa


Characters for Names in Small Basic

General rule for variable, label, subroutine names are:

  • starts with "_" or alphabet character.
  • followed by "_", alphabet or number.

But I found some multi-byte characters can be used for these names in Small Basic.  There are not official documents about it.

So following is my conjecture about which character can be used for variable, label and subroutine names:

  • Double byte characters can be used like alphabet.
  • But no double byte symbol can be used.

Sample code is here.

I think this is useful for following cases:

  • to write names in your local languages. ex. なまえ = "のんき"
  • to use Greek alphabet in equations. ex. x = r * Math.Cos(θ)

See Also

Comments

  • Anonymous
    May 13, 2016
    Great. I read this, and I'm asking when we'd want to use it, and then near the end you explain that beautifully...I think this is useful for following cases:1. to write names in your local languages. ex. なまえ = “のんき”2. to use Greek alphabet in equations. ex. x = r * Math.Cos(θ)Thanks, Nonki!
  • Anonymous
    May 23, 2016
    Hi Nonki question ?in a program (No.: BMC859) I wrote last March, part of the Challenge of the month, this program solves a quadratic equation.to find the discriminant called Delta, I wrote this:Delta = (Math.Power(b,2))-(4ac)is that mean that I could have write this instead:Δ = (Math.Power(b,2))-(4ac)
    • Anonymous
      June 06, 2016
      YLed, yes you can use Δ as variable name.
  • Anonymous
    June 06, 2016
    I found a tip about Greek alphabet. Greek alphabet is also case insensitive. So, following variables will have same values.ω = 10Ω = 20