Greenfoot world backgrounds12/6/2023 It takes a boolean parameter (remember true/false) and gives the program the ability either to commence something or to skip it. The if statement is one of the most widely used one in any programming language. One of the most frequently used condition is the if statement In order to make objects do certain actions in certain circumstance, a conditional statement is required. Because this is all it can do, when it hits the end of the world, it does not know what to do thus, stops moving. Right now, as you can see, all the crab is able to do is move. Okay, remember how to open the editor? Let’s double click on the Crab class icon on the right. So in this lesson, we’re going to make it go all over the place and eat something. Last lesson we were able to get out crab move from left to rightīut this isn’t all that interesting to watch for long, is it? But that aside, did u notice how I used the comments? Yeah, that’s how you should use them. joking, it doesn’t have to be really important… but where the fun in that?ĭid u get it? It’s kinda confusing, right? It was confusing for me the first time □īut we’ll see how this works later on with more examples. * This method will work as an example of how to write a method. Where should we start? Well, it all starts with a … If you put all codes in one single run method, first of all, it’ll be really hard to see and not to mention, slow down the program – since the program will have to read through all the long program to find the code it actually will use.įor this, you will start creating methods. There is nothing wrong with this, except as you advance in the art of programming, you will find your program becoming longer and longer. Until now, I just put all the methods in the run method. * all lines until they see a “*/” or an asterisk and a slash, which signifies the end of a MLC. * They start with “/*” or a slash and an asterisk and they continue on * descriptions of the actor, or key methods in the program. * Mutiple Line Comments (MLC) are generally colored blue. On the other hand, there is a multiple line comments. They are mostly used for commenting on methods and giving short descriptions of small details in the program. The Single Line Comment (SLC) always comes after “//” or two slashes. One is the single line comment, the other is the … you guessed it – the multiple line comment. In Greenfoot – as well as some other programs – there are 2 major ways of writing comments. Hi all! Today I wanted to give y’all some info.
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |