IchigoJam BASIC Tutorial 日本語版

What is programming - プログラミングってなに?

1.1 what is programmming? -

Thank you for watching the Ichigojam video series. In this video we are going to learn what programming is. Let’s start with an example-

If your mom tells you to buy milk. What will you do first?

  1. Take the money
  2. Go to the shop
  3. Get the milk
  4. Return home

Pretty simple, right? But how much milk should you buy? What will you do if the usual store is closed?

You may know the answers, but for a computer, you need to provide the exact instructions, with conditions for different situations and how to handle it. That, in essence, is programming. So basically programming is giving exact instructions to the computer to solve a problem. If your instructions are clear & correct, the computer will do whatever you will ask it to do. It can be anything- calculating numbers, printing your name etc. What’s so amazing about programming? It depends on you what you want to do. You know about robots, right? It works by instructions, those instructions are written by programming. Programs can make games. Program can make animated movies. Programs are behind all the websites like Google, YouTube, Facebook and Twitter. You use a smartphone everyday. Behind all your smartphone’s applications everything is programming.


1.2 How does communication happen between humans and computers?

In my last video I explained about programming. Programming is about giving instructions to computers for solving a problem. When we talk to each other how do we communicate? We use human language, right? We have our own language to communicate with each other. But how to communicate with computers? Do computers also understand our human language? The answer is, no it doesn’t. But then, how do computers understand the instructions given by us? Making a language that both humans & computers can understand was tough. Long time ago programmers used to give instructions using binary code. Now you must want to know, what is binary code? Binary code is a combination of 0 and 1. Computers only understand this binary code. Earlier times, programmers had to write very long instructions using 0 and 1. It was really difficult to do and also it took a long time. So the scientists invented programming languages which are almost close to our human language. Programming language was invented so that we can give the instructions easily. But the fact is, computers still can’t understand these instructions, because it only understands 0 and 1. Then how does the communication happen between humans and computers? The scientists also invented a converter which converts programming language to binary code. The name of this converter is “compiler” which is also a computer program. The compiler is the bridge between humans and computers for communication. Compiler converts our instructions to binary code. And then the computer understands your instructions easily and does whatever you ask for it to do!

Fig: Flow of instruction execution

Summary: Computers don’t understand human language. Computer converts the instructions to a series of 0/1.

1.3 Programing languages(introduction with BASIC)

In the last video I talked about how communication happens between humans and computers. Now I am going to talk about Programming languages. From the beginning of this video series, I am talking about instructions to the computer. But how do we give instructions to the computer? Do we need to say something or do we have to write? What is the way? The way to give instructions to the computers is writing. We write the instructions using special types of languages. These languages are called programming languages. In my last video I explained that computers can not understand anything except 0 or 1. Programming language is close to human language. We humans can communicate with each other using multiple languages like Japanese, English, Korean etc. computers can also communicate in multiple languages. So we use programming languages to write our instructions. There are many programming languages named BASIC,C, C++, JAVA, Python, Ruby and many more. You can use any of these languages to write instructions to the computer. Each of these languages has their own writing style. So if you can learn how to write codes, you can do anything with the computer. You can control things, for example make a robot move, you can make games or you can do mathematics for yourself. That’s how amazing programming is! We are going to learn Ichigojam BASIC in this tutorial series. BASIC is the acronym of ​Beginner’s All-purpose Symbolic Instruction Code. As this tutorial is for kids, Ichigojam BASIC is a good programming language to start with.

Summary: Instructions to computers are written in a special language. Special languages which the computer understands are called programming languages.

2 Basic of programming

2.1 Programming Environment

Thank you for following the IchigoJam tutorial series. In this video we’re going to talk about the programming environment. Before we start programming we need to understand the programming environment. Programming environment is not an element of the programming language but it is the very first step to be followed before setting on to write a program. I said earlier that we give instructions to the computer by writing. But where should we write the instructions? If you write the instructions anywhere like a text pad, will the computer understand it? No, the computer will not understand. You need to have a proper environment in your computer for writing programming. Programming environment is setting up your computer for writing codes or instructions. As we are going to write instructions using BASIC, we need to set up a programming environment for it. We can do programming by Ichigojam BASIC in 2 ways. With ichigojam kit- Ichigojam is a very small computer designed for kids. (Video showing how to connect mouse & keyboard and how to start programming.) This is a port by which you will connect with your computer with a cable. This port is for connecting with a keyboard and this port is for connecting with a power source.After turning on the power source this screen will appear on your monitor and you are ready to go! You can also do programming with ichigojam BASIC by the internet. For this you don’t need to prepare anything special. You only need a computer and internet connection.

Open your browser and go to the following link - https://fukuno.jig.jp/app/IchigoJam/

It is written - Ichigojam BASIC 1.4.3web jig.jp Ok

If you see this, you are ready to go. You can write code here. I’m going to use this website for writing codes throughout this video series. Summary: Programming environment is setting up a machine for writing codes or instructions. You can do programming in Ichigojam 2 ways- with an ichigojam kit & by internet.

2.2 Introduce various versions of IchigoJam

Thank you for following the ichigojam tutorial series. In my last video I’ve introduced 2 ways of doing programming with IchigoJam. The 1st one is with ichigojam kit. You can check my previous video about how to assemble this kit. And the 2nd one is ichigojam web. now i am going to introduce 2 more ways of doing programming with ichigojam. IchigoIgai- “IchigoIgai” is a dock station for IchigoDake. IchigoDake- “IchigoDake” is a very compact PC that you can carry around anytime and anywhere. This one is even smaller than “IchigoJam”. You can choose the programming language (IchigonQuest, BASIC, JavaScript, FORTH). Just Insert IchigoDake into IchigoIgai and enjoy programming right away. Raspberrypi- you can also use raspberry pi for programming with IchigoJam BASIC.

2.3 First programming

Today we are going to write our first programming. In my last video I’ve introduced 2 ways of programming with ichigojam. One is by the IchigoJam Kit and the other is by the internet.I am going to follow the 2nd way, which means I am going to use the internet.Let’s open the web. I am going to write our first instruction. We are all set to write our first instruction. Write - Print “Hello World!” And press enter! You just give instructions to the computer. You asked the computer, “Hey computer! Please print ‘Hello World’ for me”. And look here it prints “Hello world” according to your instruction. You can print any message on your screen by this word PRINT. But what is print?Print is an instruction whose job is to print anything. It is used for showing any message or result of any operation. Now on the screen there is only one statement. But usually a program consists of many instructions. The computer will read all the instructions from top to bottom. So you have to maintain a sequence which instruction you want to execute first. If you write multiple instructions you have to write line numbers also. For example- 10 PRINT “I am Afrin” 20 PRINT “I am learning programing” RUN For example, now you want to print “I live in Japan” in the middle. So you have to write the instruction in the right position where you want to print. 10 PRINT “I am XYZ” 20 PRINT “I live in Japan” 30 PRINT “I am learning programing” RUN Note that there is no double quote on the output. Don’t forget to write your message within the double quotation. The double quote tells the computer from where the printing should start and where to stop. There is a shorthand for PRINT. You can use “?” also to print anything. Example- ?”I love programming!”

Summary: PRINT is used for displaying any message on the screen. Maintaining sequential instruction is important in programming. You can use the “?” mark as a shorthand for PRINT.

2.4 Errors

In this video I am going to talk about Error. In english error means a mistake, something which is not right. In programming, errors are the situation when your written instructions can not be executed. In easy words, when the computer can’t understand your instructions, it will throw errors. Just like human languages, computer languages have grammar rules. But for humans, if we make grammar mistakes while communicating we can ignore the mistake. But computers can’t ignore mistakes. The errors which are related to the grammar of the programming language are called syntax errors.

For example- PRINT hello world I missed the double quotation. It didn’t print “hello world” but threw an error. It says syntax error. Syntax error means there is some problem with your instruction, the grammar is not correct. You didn’t write it properly. In my example, I missed the double quote. Or if write- PRNT “Hello world” I misspelled PRINT to PRNT! Computer knows PRINT but doesn’t know PRNT. In these types of situations computers will throw errors. Except for syntax errors, there are many different kinds of errors. I am going to talk about some common errors. Divide by 0 error - If you try to divide any number by zero, the program will throw an error. Example- ?5/0 Divide by 0 Because I tried to divide 5 by 0 which is actually not possible, I got the Divide by 0 error. Line error - Make a jump destination such as GOTO. 10 ?“HELLO” 20 ? “WORLD” 30 GOTO 100 Line error in 30 It says there is an error in line number 30. In line 30 I have written goto 100. I am asking the program to go line number 100. But there is no line number with 100. The program couldn’t find line number 100. So it throws a line error. You will learn them gradually while doing programming. You can learn more about errors on this page. The link is added in the description area of this video. Errors in IchigoJam

Summary: When the computer doesn’t understand your instructions, it will throw errors. Be careful of writing your instructions eg. not to misspell or miss double quotes.

2.5 Integer

Thank you for following the IchigoJam BASIC tutorial series. When we program, we work with different types of data. What is data? Data is nothing but collection of information. It can be any kind of information, numbers, text, anything. In programming, these different kinds of data are called data types. Today I’m going to talk about number types. In our real world, we use numbers for various purposes. How do we say the score of a football match? By numbers, right? Or if you want to buy a toy, and let’s say the price of that toy is 2000yen. Again we are using the numbers. In programming these number types are called Integers. 0,1,2….. All these numbers are called integers in programming. PRINT 1 PRINT 10000 PRINT 40000 I tried to print 40000 but it printed some different numbers. In IchigoJam the integer has a fixed range. If you use integers above or below the range, IchigoJam can’t handle it. The integer range is from -32768 to 32767. In my example, I used 40000 which is greater than the range. Because the last number is 32767 and 40000 is greater than that. Similarly if I write- PRINT -40000 -40000 also doesn’t get printed because this is smaller than -32768. So to work with the number, make sure it is within the range. Because integers have a limit. Integers range from -32768 to 32767. If you write any number bigger than 32767 or less than -32768, Ichigojam can’t process it. There is also another type of number we use in our regular life. The Rational numbers. We use “dot” to write rational numbers. But can we work with rational numbers in IchigoJam? Let’s try- PRINT 1.12 It only prints the part before “dot”. Because IchigoJam can’t read rational numbers. It can’t read from “dot” to the rest of the part of the numbers. So it throws errors. It can only read the integer part that’s why just 1 is printed. Summary: Numbers are called integers in programming. Integers range from -32768 to 32767. IchigoJam can’t handle rational numbers.

3 Input / output, simple calculation, string 3.1 String Thank you for following the IchigoJam tutorial series. In our last video we talked about number types. Except for numbers, we also use texts in our real life. For writing your names, you use letters. Or for writing your address you use letters. Letters are different types of data than integers. I hope you remember the integers type. If you don’t remember please check our previous video :) So, I was talking about letters. The letters A,B,C…..Z or a,b,c…..z are called characters in programming. But when you write your name, you need to use multiple letters, right? So when you use multiple letters together it’s called string in programming. But if you just write your name, the computer will not understand it. For example- ?Katherin It throws a Syntax error. Because Katherin is a string, we need to tell the computer that it is a string. We need to use double quotation marks(“”) to make the computer understand the starting of the string. Now let’s check an interesting thing. First I am going to clear the screen. CLS ?1+1 2 1+1=2 which is the correct result. Now if write- ?”1+1” 1+1 The result should be 2 but instead of showing 2 “1+1” is being shown. Why? Because I wrote 1+1 within a double quotation. So it was treated as a string. In my first example I didn’t use double quotation marks. It was treated as numbers and the result was also expected.In programming, anything starting with double quotes is treated as string. Even if it is a number, if you write it within double quotation, the computer will treat it as a string.

Summary: Single letters are called characters in programming. A sequence of characters is called string. Anything written within double quotes, will be treated as string. Even if it is a number.

3.2 Variables A variable is a piece of information that does not have a fixed value. For example- there are 3 apples in a basket. So you know, there are 3 apples in the basket. But what happens if we add a 4th apple to the basket? The number of apples in the basket is no longer 3. The number of apples has been changed. The number may increase or decrease. It’s not fixed. That’s why the number of apples can be a variable. In computer programming, a variable has a name and contains a value. Variables can store a single type of value. It can only store a number, not string or a character. You can use the variable for storing value and use it later. How to use variables in IchigoJam? So the rule of writing a variable is- name of the variable, equal sign, and after the equal sign, the value you want to store. A = 100 PRINT A 100 So A is a variable and it is storing the value 100 in it. What will happen if I write other instructions after writing the variable? For example- A = 100 PRINT “I AM KATHERIN” PRINT “I LIVE IN JAPAN” PRINT “I LOVE PROGRAMMING!” I have written 3 instructions after writing the variable. Does the variable A still have the value? Why don’t we check? PRINT A 100 So we got the value 100 which we stored at the beginning. But how long will the variable store the value? As long as we don’t change the value. For example- Clear the screen. CLS A = 20 A = 50 A = 60 I stored 3 values in the variable A. Now, what will be the value of A? PRINT A 60 A has the value 60. As I said earlier, variables can store only one value. And it will only store the last updated value. That’s why 20 or 50 were not stored. Only 60 were stored. What will be the name of variables? You can use any letters from A to Z. But you can’t use special characters like $,#,& etc as the name of variables. $=40 You got a syntax error. You also can’t use 2 or more letters for naming a variable. AA = 30 You got the same syntax error. You can only use english alphabets for naming variables. Summary: Variables are containers for storing value which can be used later. You can only use a single english alphabet for naming a variable.

3.3 Input from keyboard Thank you for following the IchigoJam tutorial series. Today our topic is Input. What is input? Input is some information that we put into something. For example, when your mom calls you, you hear by ear.Your ear receives information and after receiving information you just respond. But for humans, receiving information we don’t call it input. The term input is used for computers. Computer receives the input, processes it and produces the result or output. By this time whenever we gave any value to the computer, we wrote it directly in our code. So the value was fixed. For example- A = 20 PRINT A It prints 20 which is correct. But what if I want to change the value of A from 20 to 30? I have to write it again? Yes, that is one way. But you can also set the value from the keyboard.
Example- INPUT A ? You can see a question mark is shown. It means the computer is asking the value from you and you have to provide the value from the keyboard. ?60 I set the value of A as 60. Now if you print the value, You can see it. PRINT A I used a new instruction INPUT. INPUT is used for getting value from the keyboard. The rule of using INPUT is- INPUT, followed by a variable. You can only get integer values from the keyboard using INPUT, but can not get string by INPUT. INPUT B ?”HELLO” OK PRINT B 2402 If you try to get a string by INPUT it doesn’t show any error, but it gives the wrong value of variable B.

Summary: By using the INPUT function you can take value from the keyboard. If you use INPUT, you must use a variable to store the value. The INPUT function can not process strings. You can only take integers from keyboard using INPUT

3.4 Arithmetic Operators Thank you for following the IchigoJam tutorial series.You can easily do mathematical calculations using programming. In this video, we’re going to learn about Arithmetic operators. Generally in mathematics, arithmetic is the basic study of numbers. The four basic arithmetic operations are addition, subtraction, multiplication and division. The numbers used for an operation are called operands. And the symbols we use to indicate the operations are called operators. The signs we use in real life for doing mathematical operations are the same in the programming world. You can use- Addition(+), Subtraction(-), Multiplication(), Division(/) for doing mathematical operations. Example- I’m going to use line numbers for demonstrating mathematical operations. Line numbers are used for telling the computer which instruction should be processed first. 10 A=10:B=2 // you can use “:” if you want to write more than one instruction in one line. 20 PRINT “SUM=”,A+B // if you want to print string and integers in one print you separate them by comma. Here “sum=” is the string and the result of A+B is an integer, so I separated them by comma. 30 PRINT “SUBTRACTION=”,A-B 40 PRINT “MULTIPLICATION=”,AB 50 PRINT “DIVISION=”,A/B If you use line numbers, you have to use the RUN command to tell the computer to process your instructions. RUN As you can see the result of 10+2=12 which is correct. Also the results for other operation subtraction, multiplication and division are also correct. Except for these four operators, there is one more operator that is used for mathematical operation. The name of the operator is modulo operator. Modulo operator is used for calculating the remainder of division operation. CLS For example- PRINT 5/2 2 5 is not equally divided by 2. Result is 2 but the remainder is 1. Modulo operator produces the result of the remainder which is 1 in our result. But what is the symbol for modulo operator? In programming we use the “%” symbol for modulo operator. PRINT 5%2 1 PRINT 11%7 4 Now you know how to do mathematical operations using programming. Now let’s try to do some simple coding.
Exercise- Take two numbers from the keyboard Calculate addition, subtraction, multiplication, division and modulo operations of the two numbers. Use line numbers. Please try to solve the problem by yourself.and at the end of the video I’ll share the solution. Summary: You can do mathematical operations by programming. You can use +,-,,/ symbol for doing calculations. Modular operator is used to calculate the remainder of the division. Solution: 10 INPUT A:INPUT B 20 PRINT “SUM=”,A+B 30 PRINT “SUBTRACTION=”,A-B 40 PRINT “MULTIPLICATION=”,AB 50 PRINT “DIVISION=”,A/B 60 PRINT “REMAINDER=”,A%B

3.5 Relational Operator Thank you for following the IchigoJam tutorial series. In my last video I talked about arithmetic operators. In this video, we are going to talk about relational operators. We have already talked about operators. An operator is a symbol that represents an action. For example, “+” operator represents addition. Arithmetic operators are used for mathematical calculations, while the relational operators are used for comparing numbers. For example- The number 20 is obviously greater than the number 10, right? But you want to ask the computer if it knows it or not? How will you ask? Here you need the relational operator. ?20>10 If you don’t remember what “?” is, it’s just a shorthand for PRINT :) 1 So the computer shows 1. What does it mean? It means TRUE. The number 20 is greater than 10 which is TRUE. The computer also says it’s TRUE. I’ve used the “>” symbol for comparing two numbers, that’s why the “>” symbol is a relational operator. Example- ?20<10 0 Now the computer shows 0. 0 means FALSE. 20 is not smaller than 10 right. The computer also says, it’s FALSE :) I’ve used the “<” symbol which is also a relational operator. How many relational operators can IchigoJam handle?? “==” => checks if two values are equal. You are familiar with the “=” symbol which we use to assign value to a variable. But “==” is used for comparing if two numbers are equal. Example- ?5==5 Shows 1 because it’s true. ?4==5 0 4 is not equal to 5, it’s false. “!=” => check if two values are not equal. Read as “not equal”. It’s the opposite of the “==” symbol. It compares if two two numbers are not equal. ?10!=7 1 10 and 7 are not equal and it’s true. ?20!=20 0 Of Course 20 is not equal to 20 is false. “>=” => check if one value is greater than or equal to another. Read as “greater than or equal”. Example- ?15>=12 1 which is true ?15>=15 1, true “<=” => check if one value is less than or equal to another. Read as “less than or equal” Example- ?12<=15 1 which is true ?12<=12 1, true

These are the relational operators we usually use in programming :) . We use relational operators concept during decision making. To know about decision making, please follow our next video. :)

Summary: Computers use relational operators to compare between numbers are called relational operators. The result of the comparison is always shown as 0 or 1. 0 means false, 1 means true.

4 Conditional statement (if… .else), Loop 4.1 Conditional Statement Thank you for following the IchigoJam Tutorial. In this video, we are going to talk about decision making in programming. What is decision making? Let’s think about real life scenarios. If my mom finishes cooking dinner, I will eat dinner. Otherwise I will finish my homework. I am making a decision about what I’m gonna do based on “if my mom has finished cooking or not”. So every time while making a decision, it has 2 parts. The first part is the condition. And the second part is making the decision for doing some action. Remember in our last video, we talked about relational operators? We need the concept of relational operators for decision making. Let me give you an example. Consider the mark of a student. If the mark is greater than 40, he is passed. If the mark is below 40 he will fail. Let’s do some coding :) 10 M=50 20 IF M>=40:?”PASSED” 30 IF M<40:?”FAILED” In line number 10 I’ve taken a variable name M and set the value to 50. Let’s assume 50 is the mark. In line 20, I’ve written a condition. If M is greater than or equal to 40. The value of M is 50. Is 50 greater than or equal to 40? Yes it is. It becomes true. Remember I said earlier decision making has 2 parts. The first one was condition. Checking if 50>=40 or not is our condition. Because it’s true, we need to do the 2nd part, making a decision. In this case I made a decision that I just want to print “PASSED”. Now change the value of M from 50 to 30. This time, 30 is less than 40, the condition of line 30 became true and printed failed. You may have already noticed that I’ve used a new keyword IF. followed by IF you need the condition. Exercise- Use the INPUT function to take an integer from the keyboard. Print if the number is even or odd. Hint: how do you judge if a number is even or odd? If the number is divisible by 2 then it’s even. Otherwise it’s odd. Please try to solve the problem by yourself. I will share the solution at the end of this video. Summary:

Decision making has 2 parts. First part is the condition & the second part is making the decision. Computers understand decision making by IF keywords along with some conditions.

Solution: 10 INPUT A 20 IF A%2==0:?“EVEN” 30 IF A%2==1:?“ODD”

4.2 Array Thanks for following the IchigoJam video series. In this video I’m going to talk about arrays. :) An array is a way of arranging things. The basic concept of an array is like a variable. You remember about variables, right? Variable is like a container which can store a value. Arrays can also store values like variables. But the difference is that variables can store only one value. And an array can hold many values, it’s because an array is a collection of elements. An array has two important things. Elements and index. Elements are the values needed to be stored in an array. Index means the position of an element in the array. Let’s try an example to understand it better-

Example- LET [0],2,5,7

LET is a keyword for initializing an array. Followed by the starting index, means in which position the first should be stored. Then the elements should be separated by comma. One important thing about arrays is that the positioning always starts from 0. Means the first element should be placed at 0 index. So I’ve written 0 within the square brackets. After that I’ve written the elements.In my example, I’ve stored 3 elements in the array. 2, 5 and 7. The first element is 2 and the array should start positioning from 0. 2 should be placed at index 0. Let’s check it- ?[0] 2 The next element is 5 and it should be placed at index 1. Let’s try- ?[1] 5 And element 7 should be placed at index 2. ?[2] 7 Now let’s see another example. First I’m going to clear the array- CLEAR // clear command is for clearing variables and arrays. LET [1], 10,20,50 In this example I’ve started the indexing from 1. So, 10 should be at index 1. ?[1] 20 & 50 should be at index 2 & 3 respectively. But what is in index 0? Let’s try- ?[0] 0 It shows 0. Because there is no element in index 0. What about index 5? ?[5] 0 Same result. If an index which doesn’t have value, it will show 0. And also you should always start your indexing from 0. It’s good and standard practice :) In IchigoJam you can store from [0] to [101] meaning 102 elements in an array. If you try to store in [102] you will get an “Index out of range” error. Let’s try- [102]=50 Index out of range So you can only use from [0] to [101] index. Summary: Arrays can store multiple values and each value has an index. In IchigoJam you can store values from index [0] to [101]. 4.3 Make simple calculator Thank you for following the IchigoJam video series. In this video we are going to do an interesting project. We are going to make a simple calculator!! :D Before I start, I would like to introduce a new topic. We are going to use ASCII code for making the calculator. Now What is ASCII? ASCII stands for American Standard Code for Information Interchange. It is a code for representing 128 English characters as numbers, with each letter assigned a number from 0 to 127. For example- the ASCII code for lowercase “a” is 97. But the code for uppercase “A” is 65. Every character in the keyboard has its own ASCII code. You can check the full ASCII list from the link attached in the description section. ASCII Table But why do I suddenly introduce ASCII code. Because I need ASCII code for making the simple calculator. Do you remember when I introduced INPUT, I said that you can’t take strings as input from the keyboard? You can only take numbers from the keyboard. For basic mathematic calculation we need “+”,”-”,”” and “/”. These 4 operators are characters and we can’t take characters from the keyboard. But if we take the ASCII code of the character then we can take it from the keyboard. We need one more instruction to convert the character to ASCII code. IchigoJam has “ASC” instruction to convert from character to ASCII code. Let’s try to get the ASCII code of a character. Example- ?ASC(“+”) 43 ?ASC(“-”) 45 ?ASC(“”) 42 ?ASC(“/”) 47 As you can see the ASCII code for “+” is 43, “-” is 45, “” is 42 and “/” is 47. Please remember the codes :) Let’s start our coding- CLS 10 LET [0],ASC(“+”),ASC(“-”),ASC(“"),ASC("/") In this line I’ve declared an array. Using ASC I’ve saved the ASCII codes of +, - , , / operators. So at [0] 43 is stored, at [1] 45 , [2] 42 and [3] 47 is stored. 20 ?”FOR ADDITION(+) TYPE“,[0] This line is just an information which actually tells the ASCII code of (+) 30 ?”FOR SUBTRACTION(-) TYPE“,[1] Same as previous line, tells the code for (-) 40 ?”FOR MULTIPLICATION() TYPE“,[2] Same as previous line, tells the code for () 50 ?"FOR DIVISION(-) TYPE",[3] Same as previous line, tells the code for (/) 60 INPUT "TYPE FIRST NUMBER:", X Will ask the first number 70 INPUT "TYPE OPERATOR NUMBER:", S Will ask for the operator number 80 INPUT "TYPE FIRST NUMBER:", Y Will ask the first number 90 IF S==[0]:?"SUM=",X+Y S has the ASCII code for the sign to be taken from the keyboard. In this line we are checking if the sign is plus. Because at index [0] we have stored plus signs. 100 IF S==[1]:?"SUBTRACTION=",X-Y Minus sign is at index [1]. So we are checking if S is minus. 110 IF S==[2]:?"MULTIPLICATION=",XY Asterisk sign is at index [2]. We are checking if S is multiplication. 120 IF S==[3]:?”DIVISION=",X/Y Forward slash sign is at index [3]. So we are checking if S is a division. RUN

The first four lines just displays the ASCII code of +, -, * and / This is a sample code of how to make a simple calculator. Hope you enjoyed the video. 4.4 FOR Loop Thank you for following the IchigoJam tutorial series. In this video, we are going to learn about the loop :) What comes to mind when you hear the word loop? A loop means repeating the same task. Let’s look at a real life example of a loop. Every morning after you wake up, what tasks do you do? In most cases, brush your teeth, eat breakfast and go to school. This is a loop. You are doing the same tasks every morning. In the programming world, loop also means the same thing, repeating some instructions for certain times. If I ask you to print numbers from 1 to 10 how will you do that? Maybe, you will use print 10 times. What if I ask to write numbers upto 50? This time it’s difficult, right? Here you can use a loop. But how to write a loop? First of all you have to use the FOR keyword. A loop has three parts. First is to decide the starting of the loop. The second part is a condition, how many times the loop should be repeated. The third part is STEP. STEP means increasing the current value of the loop. Let’s write an example to understand it better.

10 FOR I=1 TO 50 STEP 1 20 ?I 30 NEXT RUN

As I said earlier, a loop will start with a FOR keyword. Then the starting point of the loop. At this point we need a variable to count the current iteration number. As it is a variable you can use any alphabet, I’ve used I here. And the value of I is 1. That means our loop counting will start from 1. After that we need to write, upto when the loop should be continued. In this example the loop will continue for 50 times. STEP 1 means the value of I will increase by 1 after every iteration. In line 10 the value of I is 1. In line 20 it prints the value 1. In line 30 NEXT is written. NEXT means the next cycle will start and here the value of I will become 2. The loop will again goto line 10 and it will check the value of I is not 50 yet, because it’s 2 now. In line 20, 2 will be printed. Then again in line 30, the next cycle will start and the value of I will be increased by 1 and it will become 3. Like this the loop will continue upto 50 times. You can also control the increment part. It’s not necessary to increase by 1 every time. You can increase the value by any number you need. Let’s see an example- 10 FOR I=1 TO 20 STEP 3 20 ?I 30 NEXT You can see that in every iteration the value I has been increased by 3. If you check the last line, after printing 19, 20 was not printed. Because 19+3=22 and we said our loop should continue upto 22. That’s why, after printing 19 the loop was stopped.

Summary: Loop is used for repeating some tasks for a certain number of times. Loop has 3 parts. Initializing, condition to stop the loop and increment.

4.5 GOTO Thank you for following the IchigoJam tutorial series. In this video, we are going to learn about another way of writing a loop. As I said in my previous video, loop means repeating some instructions multiple times. We already learnt about the FOR loop. Now we are going to use GOTO instruction for looping. Like the FOR loop, GOTO loop also has 3 parts. First we have to set the starting point of the loop. After that, write a condition for how many times the loop should repeat. And the last part is incrementing the current iterator value. Let’s see an example to understand it better. Example- 10 A=1 A is just a variable and I initialized the value to 1. 20 IF A==15:END This line checks if the value of A is equal to 15 or not. If it’s 15, the loop will stop. For now A=1 so it will go to the next line. 30 ?A Prints the current value of A. 40 A=A+1 Increase the value of A by 1. Now it has become 2. 50 GOTO 20 GOTO 20 means it will goto line number 20. What’s written there? Line 20 checks if A is equal to 15. Now A is 2 , so it will goto next line and print the value of A. Like this, the loop will continue until A is not equal to 15. Let’s run the program- RUN The program prints from 1 to 14. It didn’t print 15 because when A=15 the condition written at line 20 became true and the loop was stopped. One very important thing about loop is if you don’t write the condition properly or you write the condition properly but forget to increase the counter variables value the loop will become an infinite loop. Let’s see an example- 10 A=1 20 A==5:END 30 ?A 40 GOTO 20 RUN At line 20, I’ve written a condition that when A is equal to 5 the loop will stop. But Later I never increased the value of A. A is always 1, the condition of line 20 never comes true and the loop never ends. It keeps printing 1. This type of situation where the loop doesn’t end is called an infinite loop.

Summary: Loop is used for repeating any task. You can use FOR and GOTO loop whichever you need. Be Careful of writing your loop breaking condition or it might be an infinite loop.

4.6 Multiplication Table Thank you for following the IchigoJam tutorial series. Until our last video, we discussed all the basic programming concepts. Using the concepts, can you make a multiplication table by yourself? Don’t worry if you can’t. Because today we are going to make a multiplication table by programming :) Let’s start- First we are going to take 2 inputs from the keyboard. 10 INPUT A:INPUT B For a multiplication table, we need to multiply the numbers and repeat it multiple times, right ?Now we know about loop so we can use loop. I am going to use the FOR loop. 20 FOR I=1 TO B STEP 1 The loop will start from 1 and will continue until the value of I is not equal to B. B is the input we will give from the keyboard. 30 ?A,"“,I,”=",AI This line at first will print the value of A, after that an asterisk will be printed,then the current value of I followed by an equal sign. And the last part is important. It prints the result of the multiplication. In every iteration the value of I will be different and it will produce different results. If you notice carefully, I’ve used commas to separate strings and integers. 40 NEXT NEXT will start the next iteration. Lets RUN the program- RUN ?2 ?20 I’ve taken 2 inputs, 2 and 20. We are going to create a multiplication table of 2 upto 20. In the first line, when I=1, 21=2 was printed. In the next iteration value of I became 2 and 22=4 was printed. In every iteration the value of I has been increased and it was multiplied by 2. You can try any numbers. Now you can create a multiplication table programmatically. Hope you enjoyed the video. Keep playing with the multiplication table :)

5 Make simple game 5.1 Functions in IchigoJam Thank you for following the IchigoJam tutorial series. Today we are going to learn about some functions in IchigoJam. A function is a code that performs a task. We have already used some functions in our previous videos. PRINT is a function whose job is to print messages. We’ve used the INPUT function to take input from the keyboard. There are some more useful functions in IchigoJam. I am going to introduce them in this video- WAIT - wait n frames, 60frame = 1 second. Means if you write “WAIT 60” it will wait for 1 sec. Example- 10 WAIT 120 20 ?”HELLO” RUN After waiting for 2 sec “HELLO” was printed. LIST - show the program in memory. Shows the last program which is currently in memory. If there is nothing in the memory nothing will be shown. NEW - delete all the programs in memory. LOCATE(x,y) - set the position to write. x & y refers to the position of x & y coordinates in the screen. 10 LOCATE 10,5 20 ?”hello” You can also use LC to do the same thing. LC is the short form LOCATE. CLS - clear the screen. You already know about it. RND(n) - return a random number from 0 to n. ?RND(6) Return any number within 0-6 BTN - return 1 if you push the button, else 0 CHR - In PRINT, shows the letter string specified the ASCII number. Can be used only with PRINT. ?CHR$(65) ASC - gives the letter code from character. ?ASC(“B”) PLAY - play the music specified mml(Music Macro Language). PLAY “CDE2CDE2” LEN - gives the length of the string. Meaning how many characters are there in the string. ?LEN(“PROGRAMMING”) CLT - clear the time count TICK() - return the time count from CLT SCR(x,y) - return the letter code located x, y on the screen.

There are some more functions. If you are interested you can check this page- https://ichigojam.net/IchigoJam-en.html

5.2 Simple Game Thank you for following the IchigoJam tutorial series. This video is the last video of this series. We are going to make a simple game. Let’s get started :D 10 CLS:X=16:CLT First we’ll clear the screen. Set the value of variable X to 16 and S to 0. CLT function is used to clear the time count. 20 LC X,5:?”O” Print “O” at [16,0] location. 30 LC RND(32),23:?”*” RND(32) means a random number between 0 to 32 will be generated. Let’s assume the number is 20. At [20,23] location of the screen “** will be printed. 31 LC 0,0:?”SCORE:",S At [0,0] position of the screen score will be shown. 35 WAIT 3 Program will wait for 3 frames. 36 X=X-BTN(28)+BTN(29) BTN(29) means when the left arrow button will be pressed BTN function will return 1, if not pressed 0 will be returned. BTN(29) means right arrow button.
37 IF SCR(X,5):END SCR(x,y) returns the letter code located x, y on the screen. If there’s any letter on (x,y) position of the screen the program will end. 38 S=TICK()/60 Calculate the seconds from the starting of the game. Your score will be how many seconds you survived in the game. 40 GOTO 20 Go back to line 20 and continue the process. Let’s run the program. RUN

This was our final video of the Ichigojam tutorial series. Hope you enjoyed and learned simple programming. Thank you for watching!

Explain BTN, LC,SCR, CLS

Simple simulator for shipping fee Add any product in the cart Simulator will calculate total cost, if cost<1000 add 500 as shipping fee Add consumption tax in Japan. (price*11)/10

10 CLS:X=16:CLT 20 LC X,5:?”O” 30 LC RND(32),23:?”*” 31 LC 0,0:?“SCORE:”,S 35 WAIT 3 36 X=X-BTN(28)+BTN(29) 37 IF SCR(X,5):END 38 S=TICK()/60 40 GOTO 20

Hello, my name is Afrin. I am from Bangladesh. I have been living in Miyazaki for the last 2.5 years. I am a software developer. I will be your instruction in this tutorial series. See you in the tutorial.

Hello, my name is Kat. I am from the Philippines. I have been living in Miyazaki for almost 4 and a half years. I am an English teacher and I will be learning BASIC programming with you in this series. Let’s go!