Saturday, June 05, 2021

Nintendo Switch lite - SmileBASIC4 - Coding Console Calculator


Nintendo Switch Lite - Blue

Hey guys,

Check it out!

One of the things I like about my Nintendo Switch lite is that I'm not just using it for gaming. I like watching videos on Youtube and also listening to music. No Netflix? No Spotify? Well, you just need youtube. Once awhile, I'll post pics and short clips videos on Facebook or Twitter.

Another thing I like is the software SmileBASIC4 and FUZE4. Although, I mostly spend my time with SmileBASIC more. You can learn to code games and play them on your own Switch. What I really like about SmileBASIC is that it's not just for games. The language is pretty much similar to BASIC and Python.



Nintendo Switch Lite - Blue

I'm more into Python because of Raspberry pi. I had always wanted to learn to code but didn't get the chance when I was in school. I only saw that you can create your own smart car robot with Raspberry Pi and Arduino that I was interested in. That's where I started to learn to code with Python.

The kids nowadays got the chance to learn about programming with Microbit. I actually got it for myself too. Playing with them is really fun. And, of course, it's more fun learning to program with 'toys' like this. Where you can literally see things work.



Adeept BBC Micro:bit Sensor Starter Kit | Microbit Programmable Starter Kit for Micro:bit with 35 Projects PDF Tutorial Book | Micro:bit and Expansion Board Included

Anyway, I played with Microsoft Visual studio and followed a tutorial to create a console calculator with C++. There's also a tutorial for C#. Instead of following the tutorial, I was wondering if I could take some of the code and create a console calculator on my Switch lite with SmileBASIC4.

I thought the core of the code in C# which is the calculation is pretty simple enough to redo with SmileBASIC. This is the part where knowing Python actually helps me. The fact that SmileBASIC is similar(almost) to BASIC and Python makes it much easier.



Learn C++ Quickly: A Complete Beginner’s Guide to Learning C++, Even If You’re New to Programming (Crash Course With Hands-On Project)

I was actually stuck with the INPUT problem in SmileBASIC 4. In python, I could easily let a user input to choose an option and then Print whatever I want. It keeps coming out with all the answers for plus, minus, multiplication, and divide.

I thought to just let it be. I don't think there's any calculator in the world that gives out an answer all at once. Lol. In the end, I decided to ask @notohoho, the CEO of Smileboom on Twitter. He was kind enough to answer my question the last time. Thankfully, he was also keen to help me this time around too.


I was stuck trying to print the option of the user with the INPUT command.


Probably, one of the @notohoho students or SmileBASIC users gave me a solution of using the command OPTION aka opt$.


While @notohoho gave me this solution of using the command INSTR(OPT$,"").

I tried both of the solutions and it didn't work at first. It was only when I realized that I had put the endif at the wrong place. You can see the pics of my earlier code where I've placed all the endif at the bottom, instead of after every if. That's basically how I learn, from trial and error.


I decided to add an option "x" where the user can get all the calculation answers at once. Kinda cool!

       

The second part of the final code. Of course, you can copy these. Add anything you want to it. I was even thinking of adding background music. I can even upload it to the SmileBASIC server but I'm lazy. There are others that already upload better calculator apps.

You can watch the video and see how it works here



Nintendo Switch with Neon Blue and Neon Red Joy‑Con - HAC-001(-01)

If you had gone to visit the C# tutorial page, you'll see that the console calculator looks similar to the one I created using SmileBASIC 4. There's actually more to the C# tutorial and personally, the code is more 'cumbersome' to me. While with SmileBASIC4, it looks much simpler.

That's part of another reason why I like SmileBASIC. It's simplicity. I guess it's meant to be easy. For learning purposes. For a newbie like me? Also, with the Nintendo Switch, its portability meant, you can bring it and code anywhere. I actually code this calculator while in bed using the on-screen keyboard.

I'm self-learning coding just for fun and basic knowledge. Like I've said, I've been wanting to learn to code since I was a child. The kids nowadays are so fortunate that there are many programs suited for their age to learn. The good thing is that because of the Internet, it's much easier to research and learn online.

If you're interested, come join the fun!

What you guys think?

Help support this blog and youtube channel. Buy me Coffee @

https://www.buymeacoffee.com/W04oadL

*Shop the latest deals from Amazon via our links to support us. Tq!

Subscribe to our blog and youtube channel for the latest post and video upload!

Happy coding!


P.S. Nintendo Switch Lite - Blue




No comments:

Post a Comment

Spam will be deleted.

Note: Only a member of this blog may post a comment.

Games & Tech Featured Post

The Future of AI: Trends Shaping Our World in 2025 and Beyond! #AI #futureofAI