[Sticky] CASIO Basic Syntax - Introduction  

  RSS

0

CASIO Basic may be one of the greater evils to fly out of Pandora's box, but never-the-less it is the only language we can bring into the exam hall. So why not make use of this resource?

Creating a Program

CASIO for reference.

To start off, you will have to make a program. To do so, go to the menu-option shown above and proceed with common sense.

Variables

The assignment operator is the humble '' we all know and love. Don't worry though, there is a key for it.

You don't have to worry about declaring your variables in any precise manner, think of it like Python's slightly less-abled brother.

32N // Assigns 32 to N

The more observant of you may have noticed that I added a comment there. You cannot, however, add comments in CASIO Basic. How lovely?

One thing I will say is quite nice with CASIO Basic is being able to assign the same value to many variables. Though, the variables must be in alphabetical order. But every silver cloud has a slightly rusted lining, that's how the saying goes right?

16A~D // Assigns 16 to A B C & D

Though this functionality exists, and I know it does, I am yet to find the ~ key on my calculator (after 2 years of owning it). So if you do find it, leave me alone.

Recursion

We use loops to repeat blocks of code, though you know that already I'm not quite sure why I said it. There are several types of loops in CASIO Basic:

  • Goto/Lbl
  • Do/IpWhle
  • While/WhileEnd
  • For/Next

First off lets look at the bad one:

1P // Assigns 1 to P
Lbl 1
P+1P // Increments P
Goto 1 // Returns to Lbl 1

This has no bounds and so will execute infinitely (or atleast to the bounds of the calculator).

Next, let's look at a personal favourite: the for loop. What a gal.

For 1P to 100
// Code goes here...
Next // Returns to the For loop

One thing that CASIO has implemented, another gold nugget in an otherwise sewage-ridden river, is having the ability to change the value of the step.

For 1P to 100 Step 4
// Code goes here again...
Next // You get the idea

Now, this may be a strange place to mention, but there is no indentation. Good luck seeing where those otherwise indeterminable 'Next's return to.

Next up, while loops. I couldn't think of anything witty to write so let's just do it.

1A
While A<10 // will be true until A is 10
A+1A
WhileEnd

So there we have an example of a predetermined iteration, and a... yet to be determined iteration. Remind me to edit this when I think of the correct name for that.

Printing

Let's make this quick, shove some text in quotations and it'll be printed... that's it.

"I told you"

Here it is as seen on a CASIO screen.

Conditional Branching

It may look intuitive, and that's because it is. They really didn't fluff it up like some other languages do, it's as simple as it comes.

If A=1
Then "A is 1." // if expression is true
"What an enlightening epiphany?"
Else "A is not 1." // if expression is false
"The chances were slim anyway."
If End // end of statement

If A does equal 1, then the calculator will print:

A is 1.
What an enlightening epiphany?

Else, if A is not 1, it will print:

A is not 1.
The chances were slim anyway.

"Computer science is no more about computers than astronomy is about telescopes."
~ Edsger W. Dijkstra

 
0

Well, at least it is programmable. And its easy enough to understand. Even for me, and my adverse phobia of computer languages.

"Either this wallpaper goes, or I go"- Oscar Wilde's last words

 
0

That phobia is the thing that gives me job security 🙂

"Computer science is no more about computers than astronomy is about telescopes."
~ Edsger W. Dijkstra

 
0

I should mention, because I didn't in the introduction, but the symbol '' is the carriage-return or end-of-line symbol. Much like the ';' in many languages.

"Computer science is no more about computers than astronomy is about telescopes."
~ Edsger W. Dijkstra

 
0

Location of the '~' key. You have to go into the character list, and then the second tab.

"Computer science is no more about computers than astronomy is about telescopes."
~ Edsger W. Dijkstra

 
0

As a Casio Basic Enthusiast, and advocate of Advanced Casio Banter, I find your Pandora's box analogy most disturbing. Casio Basic is a beautiful gift of a language, it may be a pig to edit, but its outrageously easy to use, and ensures you always have coding facilities in your pocket, assuming you keep your Casio in your pocket. As any gentlemen without his calculator: is a gentlemen improperly dressed, and in need of some discipline. 

 

Btw loving the Dijkstra quote #DicksOutForDijkstra

 
Share:
  
Working

Please Login or Register