Ruby with Karl (Chapter 4.5)

21 1 7
                                        

READ THIS: THERE ARE WEIRD LINE BREAKS EVERYWHERE BECAUSE WATTPAD ALSO RECOGNIZES \ n as a linebreak. If you see a weird line break, assume a backslash n is supposed to be there


Moin, moin, gamers. //i am sorry for not being able to properly imitate a north german accent. im from bavaria and i speak with that accent
Karl Tech Tips here with another programming tutorial. Today we will be working with Ruby. I would call Ruby a combination of Python's simplicity and C's complexity. It's syntax is simple and readable but compared to Python it's a lot more organized and readable. //okay how do i transition from this to the teaching part

How to install Ruby (on Windows at least):
Use this https://rubyinstaller.org/downloads/ and choose between 2.7.2-1 or 3.0.0-1.
And also use Notepad++ as an IDE https://notepad-plus-plus.org/downloads/

First steps:
Create a new text file (you have to have filename extensions enabled) and rename it to "test1.rb" or something (the important thing is the .rb file extension). Then right click and click on "Edit with Notepad++". Now you are ready to become femboy, I mean programmer. This definitely is not a Femboystani Armed Forces recruitment video.

Basic shit:

print "astolfo is hot" #hashtag is a comment in ruby btw (so the program will ignore everything i put after a # until i break the line; so this prints "astolfo is hot" in the console

another way of doing that is:

puts "astolfo is hot" #this is the same as print "astolfo is hot"

now lets say you want to emphasize that fact by printing it multiple times, you have to do the following:

5.times{print "astolfo is hot"} #this is selfexplanatory

Oh no! it prints out "astolfo is hotastolfo is hotastolfo is hotastolfo is hotastolfo is hot" and that doesn't look super hot! But there is a solution, two actually:

indicates that a new line should be started and all characters in a string (that's a variable with all kinds of characters and letters) counts so:

2.times{print "astolfo is hot "} #equals "astolfo is hot astolfo is hot"

But let's make an "astolfo is hot" tower because that will assert dominance:

5.times{print "astolfo is hot

"}
#now it will print the following:

astolfo is hot
astolfo is hot
astolfo is hot
astolfo is hot
astolfo is hot

BUT WHAT ABOUT ASTOLFO TWIN TOWERS (i am sorry for this shit, i dont even want to call it a joke but its the only way i can imagine the proper implementation of n.times loops)

5.times{
         print "astolfo is hot" #do not worry this code is horribly ineffecient
         print "             " #i am sure you can improve it
         print "astolfo is hot

" #use tab to make the code look neat
}

n.times loops aren't restricted to one line of code, you can add as much code as you want, even n.times loops in n.times loops in n.times loops
In the end that will print this:

astolfo is hot             astolfo is hot
astolfo is hot             astolfo is hot
astolfo is hot             astolfo is hot
astolfo is hot             astolfo is hot
astolfo is hot             astolfo is hot

Pretty hot ngl.


VARIABLES

Ruby like Javascript (and Python my memory isn't shit) has "soft" variables compared TO FUCKING C# (WHAT THE FUCK IS A QUATERNION).
I will explain two and a half types of variables: Strings, Long variables and Constants (long variables include integers, floats, doubles and all the other number shit. Constants aren't actually variables but I'll include them here too.)

hans x marxTempat cerita menjadi hidup. Temukan sekarang