You may be thinking "and what? There's nothing special about the console. I run my terminal application, and maybe input some data. What gives!" But, you'd be wrong if that was what you thought I was talking about. I'm talking about the Command Console.
You can bring up the Command Console if you select the editor with your mouse (so that the cursor is flashing inside it), and press
F1. You will see a search bar along with a bunch of tools appear at the top at the editor.
So, let's have a look at some of them!
The best way to find out what these tools do, it to play around with them. Press a few, and read their names. But. don't do this in a Repl that you have been working on for a while. Here is some Python code that I recommend you put in a new Repl, so you can mess around with the different tools:
# Import our modules import random, os, time # introduction print("You have to try and guess the number, from 0 to 100!") # Sleep so the user can read the text time.sleep(2) # Generate a random number from 0 to 100 num = random.randint(0, 100) # Loop forever while True: # Clear screen os.system("clear") # Get the players guess guess = input("Guess: ") # Check that the guess is a number if not guess.isdigit(): # If it is not, then tell tell the user print("That is not a number!") else: # If it is, then convert it to a int guess = int(guess) # Then do the logic if guess > num: # If higher, then notify the player accordingly print("You guessed to high!") elif guess < num: # If lower, then notify the player accordingly print("You guessed to low!") else: # Otherwise, the player guessed correctly print("You guessed correctly!") # Generate a new random number from 0 to 100 num = random.randint(0, 100) # Sleep so the user can read the text time.sleep(2)
It's a simple "Guess The Number" game, written in Python for us to mess about with. It is all commented, and runs exactly how it should. Give it a quick go!
I have a few tools that I use all the time. I have learned the Shortcuts for theses tools because I use them so much. But, if you need to find the shortcuts for these tools, they are listed with the names in the Command Console. Now, let's go over some of the tools in the Command Console.
Using this tool, we can select some code, then we can also select the same amount of code above and below. To use this tool, we can choose "Add Cursor Below/Above" in the Command Console, or use
DOWN/UP referring to the arrow keys):
This can become very useful when trying to rename or delete a list of data. I find that it comes in much more useful than it first seems.
This will simply add a line comment to our code. You probably know about the shortcut
Ctrl+/ to comment out stuff, but you can also use "Line Comment" in the Command Console.
This will probably not be very useful, unless you have a broken keyboard. But, you never know.
Select Line Ends
You should know that you can select multiple lines of code by clicking and dragging your mouse. You may also know that you can select parts of the code by holding
Ctrl while clicking and dragging on the code. Instead of Using this to select all the line ends, you can select the code you want to get the line ends of.
You can then use "Add Cursors to Line Ends" to add cursors to the end of the selected area on each line.
This can make it much faster to select the ends of lines when editing things like lists.
Again, you may know that you can
Ctrl+C to copy a line and
Ctrl+V to paste it. But, did you know that you can duplicate a line up and down from the current line you are on. To do this, press "Copy Line Up/Down" in the Command Console, or use the shortcut
This is especially useful, once again, for lists. I think that most tools are to be honest.
Another useful line based tool, it the "Delete All Left/Right". This will delete all the content on a line to the left/right of the cursor. Simple, but saves time!
Find and Replace
this one is something that we have all used.
Ctrl-F will find selected text, and allow you to also replace it. Well, you can also access this in the Command Console using "Find", "Replace" or one of their variants.
Simple, but sweet. Oh, and super fast too!
This can defiantly help when you have thousands, or even hundreds of thousands of lines of code. When you get a message saying
Line 462358 Type Error! in the console, you don't want to spend the next thirty minutes scrolling. So you can use "Goto Line" to get there faster.
There are different variants once again, so choose the one which matches with what you want to do.
Fun at Last
As always, we have to have some fun. I think that the most fun tool of them all int the Command Console has to be... "Developer: Inspect Tokens". It's pretty cool to see how your code is split up.
There are many more tools available in the Command Console. I recommend that you experiment with them all. Also, hope you enjoyed the example game!
Hope you have a great day!
This tutorial was suggested by @enigma_dev .
If you have any suggestions for tutorials, leave them in the comments and I'll be sure to have a look. If you like one in the comments, then give it an up vote to show that you want to see it. It makes my life so much more easier. Thanks in advance!