|
1 | 1 | {"1":{"lang":"DE","title":"Hast du 30 Minuten Zeit? Probiere Ruby gleich aus!","chapter":"Y","answer":"","ok":"","error":"","text":"<p>Ruby ist eine Programmiersprache aus Japan, die die Softwareentwicklung revolutioniert.</p>\n\n<p>Die Schönheit von Ruby liegt in seiner Ausgewogenheit zwischen Einfachheit und Kraft.</p>\n\n<p>Du kannst Ruby-Code in den Editor eingeben und diese Buttons zum Navigieren verwenden:</p>\n\n<ul>\n<li><strong>Run</strong> → Führt den Code im Editor aus</li>\n<li><strong>Copy</strong> → Kopiert den Beispiel-Code in den Editor</li>\n<li><strong>Next</strong> → Gehe zur nächsten Lektion</li>\n<li><strong>Back</strong> → Gehe zuürck zur vorherigen Lektion</li>\n</ul>\n\n<div class=\"foxes\">Klicke auf <strong>Next</strong> und beginne, zu lernen.</div>\n","load_code":""}, |
2 | | -"2":{"lang":"EN","title":"Using the editor","chapter":"N","answer":"^\\d{1,}$","ok":"Good! You did a bit of math. See how the answer popped out?","error":"Type 2 + 6 in the editor","text":"<p>The editor window at the bottom is where you type your Ruby code, hit the <strong>Run</strong> button and\nwatch it run!</p>\n\n<p>For example, try typing some math. Like:</p>\n\n<pre><code>2 + 6\n</code></pre>\n\n<p>The output of your program should show itself in the output window.\nThere should also be a line that tells you how well you did.</p>\n\n<blockquote>\n<p>Alternatively you can hit the <strong>Copy</strong> button to copy the example code to the editor.</p>\n</blockquote>\n","load_code":""}, |
3 | | -"3":{"lang":"EN","title":"Numbers and Math","chapter":"N","answer":"^[0-9\\.,-]{1,}$","ok":"Good","error":"","text":"<p>Ruby recognizes numbers and mathematic symbols. You could try some other math like:</p>\n\n<pre><code>4 * 10\n5 - 12\n30 / 4\n</code></pre>\n","load_code":""}, |
4 | | -"4":{"lang":"EN","title":"Putting it differently","chapter":"N","answer":"^[0-9\\.,-]{1,}$","ok":"Well put","error":"","text":"<p>Did you notice that if you typed more than one formula you only saw the answer for the last one.\nWhat is going on?</p>\n\n<blockquote>\n<p>To make this website easier to use I have told Ruby to copy the result of your program to the\noutput screen at the top. So when you type a formula you get to see the results.\n<strong>But only the last result.</strong> And only if the output is still empty.</p>\n</blockquote>\n\n<p>So when you entered 2 or more formulas, Ruby only showed the result of the last formula.</p>\n\n<p>Of course you have the power to control the screen! Just type <strong>puts</strong> before each formula\n(with a space in between). Puts means: <em>‘put something on the screen’</em>.</p>\n\n<p>Try this:</p>\n\n<pre><code>puts 4 * 10\nputs 5 - 12\nputs 30 / 4\n</code></pre>\n\n<p>Now remove the puts from the last formula and see what happens.</p>\n","load_code":""}, |
5 | | -"5":{"lang":"EN","title":"Say Your Name","chapter":"N","answer":"[a-zA-Z]{1,1}","ok":"Perfect, you've formed a string from the letters of your name","error":"","text":"<p>Sure, computers are handy and fast for math. Let’s move on. Want to see your name reversed?</p>\n\n<p>First type your first name in quotes like this:</p>\n\n<pre><code>"Jimmy"\n</code></pre>\n","load_code":""}, |
6 | | -"6":{"lang":"EN","title":"Say Your Name Backwards","chapter":"N","answer":"\\w+","ok":"dooG","error":"","text":"<p>A string is a set of characters the computer can process. Imagine the letters are on a string of\nlaundry line and the quotes are clothespins holding the ends. The quotes mark the beginning and end.</p>\n\n<p>To reverse your name, type: </p>\n\n<pre><code>"Jimmy".reverse\n</code></pre>\n\n<p>(Don’t forget the dot!)</p>\n","load_code":""}, |
7 | | -"7":{"lang":"EN","title":"Counting the Letters","chapter":"N","answer":"^\\d+$","ok":"Yep. Length is also a 'method'","error":"","text":"<p>You have used the reverse <strong>method</strong> on your name! By enclosing your name in quotes, you made a string. Then you called the reverse method, which works on strings to flip all the letters backwards.</p>\n\n<p>Now, let us see how many letters are in your name:</p>\n\n<pre><code>"Jimmy".length\n</code></pre>\n","load_code":""}, |
8 | | -"8":{"lang":"EN","title":"On Repeat","chapter":"N","answer":"(\\w+)","ok":"Nice to meet you.Nice to meet you.Nice to meet you.","error":"","text":"<p>Now, you’re probably wondering what any of this is good for.</p>\n\n<p>Well, I’m sure you’ve been to a website that screamed, <strong>Hey, your password is too short!</strong></p>\n\n<p>See, some programs use that simple <strong>.length</strong> code.</p>\n\n<p>Watch this. Let’s multiply your name by 5. </p>\n\n<pre><code>"Jimmy" * 5\n</code></pre>\n","load_code":""}, |
| 2 | +"2":{"lang":"DE","title":"Den Editor benutzen","chapter":"N","answer":"^\\d{1,}$","ok":"Gut! Du hast ein bisschen gerechnet. Siehst du, wie die Antwort herauskommt?","error":"Tippe 2 + 6 in den Editor","text":"<p>Gib im Editor deinen Ruby-Code ein, klicke auf den Button <strong>Run</strong> und siehe, \nwie er läuft!</p>\n\n<p>Versuche zum Beispiel, etwas Mathe zu tippen. Wie:</p>\n\n<pre><code>2 + 6\n</code></pre>\n\n<p>Die Ausgabe deines Programms sollte im Ausgabefenster zu sehen sein.\nEs sollte auch eine Zeile geben, die dir sagt, wie gut du die Aufgabe gelöst \nhast.</p>\n\n<blockquote>\n<p>Alternativ kannst du auch auf den Button <strong>Copy</strong> klicken, um den \nBeispielcode in den Editor zu kopieren.</p>\n</blockquote>\n","load_code":""}, |
| 3 | +"3":{"lang":"DE","title":"Nummern und Mathematik","chapter":"N","answer":"^[0-9\\.,-]{1,}$","ok":"Gut","error":"","text":"<p>Ruby erkennt Nummern und mathematische Symbole. Du kannst auch andere \nmathematische Symbole ausprobieren:</p>\n\n<pre><code>4 * 10\n5 - 12\n30 / 4\n</code></pre>\n","load_code":""}, |
| 4 | +"4":{"lang":"DE","title":"Anders ausgedrückt","chapter":"N","answer":"^[0-9\\.,-]{1,}$","ok":"Gut ausgedrückt","error":"","text":"<p>Ist dir aufgefallen, dass du, wenn du mehr als eine Formel eingegeben hast, nur\n die Antwort für die letzte Formel gesehen hast?\nWas ist hier los?</p>\n\n<blockquote>\n<p>Um diese Website einfacher zu machen, habe ich Ruby so eingestellt, dass das \nErgebnis deines Programms in den Ausgabebildschirm oben kopiert wird. \nWenn du also eine Formel eingibst, kannst du das Ergebnis sehen.\n<strong>Aber nur das letzte Ergebnis.</strong> Und nur dann, wenn die Ausgabe noch leer \nist.</p>\n</blockquote>\n\n<p>Wenn du also 2 oder mehr Formeln eingegeben hast, zeigte Ruby nur das Ergebnis \nder letzten Formel an.</p>\n\n<p>Natürlich hast du die Möglichkeit, den Bildschirm zu steuern! Tippe einfach \n<strong>puts</strong> vor jede Formel\nein (mit einem Leerzeichen dazwischen). Puts bedeutet: <em>‘etwas auf den \nBildschirm drucken’</em>.</p>\n\n<p>Probier das mal:</p>\n\n<pre><code>puts 4 * 10\nputs 5 - 12\nputs 30 / 4\n</code></pre>\n\n<p>Lösche nun die ‘puts’ aus der letzten Formel und schau, was passiert.</p>\n","load_code":""}, |
| 5 | +"5":{"lang":"DE","title":"Sag deinen Namen","chapter":"N","answer":"[a-zA-Z]{1,1}","ok":"Perfekt, du hast einen String aus den Buchstaben deines Namens gebildet","error":"","text":"<p>Sicher, Computer sind praktisch und schnell für Mathe. Aber machen wir weiter. \nWillst du deinen Namen rückwärts sehen?</p>\n\n<p>Gib als Erstes deinen Vornamen in Anführungszeichen ein, etwa so:</p>\n\n<pre><code>"Jimmy"\n</code></pre>\n","load_code":""}, |
| 6 | +"6":{"lang":"DE","title":"Sag deinen Namen rückwärts","chapter":"N","answer":"\\w+","ok":"tuG","error":"","text":"<p>Ein String ist ein Set von Zeichen, die der Computer verarbeiten kann. Stell \ndir vor, die Buchstaben sind auf einer Wäscheleine und die Anführungszeichen \nsind Wäscheklammern, die die Enden halten. Die Anführungszeichen markieren den \nAnfang und das Ende.</p>\n\n<p>Um deinen Namen umzukehren, tippe: </p>\n\n<pre><code>"Jimmy".reverse\n</code></pre>\n\n<p>(“Vergiss nicht den Punkt!”)</p>\n","load_code":""}, |
| 7 | +"7":{"lang":"DE","title":"Die Buchstaben zählen","chapter":"N","answer":"^\\d+$","ok":"Jup. Länge ist auch eine \"Methode\".","error":"","text":"<p>Du hast die Reverse-<strong>Methode</strong> auf deinen Namen angewendet! Indem du deinen \nNamen in Anführungszeichen gesetzt hast, hast du einen String erstellt. Dann \nhast du die Reverse-Methode aufgerufen, die bei Strings funktioniert, um alle \nBuchstaben rückwärts umzukehren.</p>\n\n<p>Nun wollen wir mal sehen, wie viele Buchstaben dein Name hat:</p>\n\n<pre><code>"Jimmy".length\n</code></pre>\n","load_code":""}, |
| 8 | +"8":{"lang":"DE","title":"Auf Repeat","chapter":"N","answer":"(\\w+)","ok":"Schön, dich kennenzulernen.Schön, dich kennenzulernen.Schön, dich kennenzulernen.","error":"","text":"<p>Jetzt fragst du dich wahrscheinlich, wozu das alles gut sein soll.</p>\n\n<p>Nun, ich bin sicher, du warst schon einmal auf einer Website, die geschrien hat: \n<strong>Hey, dein Passwort ist zu kurz!</strong></p>\n\n<p>Siehst du, manche Programme verwenden diesen einfachen <strong>.length</strong>-Code.</p>\n\n<p>Pass auf. Multiplizieren wir deinen Namen mit 5. </p>\n\n<pre><code>"Jimmy" * 5\n</code></pre>\n","load_code":""}, |
9 | 9 | "9":{"lang":"EN","title":"Hey, Summary #1 Already","chapter":"Y","answer":"NoMethodError|undefined","ok":"Nope, it is not possible to reverse a number. Click 'next'","error":"","text":"<p>Let’s look at what you’ve learned in the first minute.</p>\n\n<h3>The editor</h3>\n\n<p>Typing code into the editor and clicking on run gives you an answer in the output window.\n(Almost) all code gives an answer.</p>\n\n<h3>Numbers and strings</h3>\n\n<p>Numbers and strings are Ruby’s math and text objects.</p>\n\n<h3>Methods</h3>\n\n<p>You’ve used English-language methods like reverse and length. And symbolic methods like the\nmultiplication method: *<br>\n<strong>Methods mean action!</strong></p>\n\n<p>This is the essence of your learning. Taking simple things, toying with them and turning them into\nnew things. Feeling comfortable yet? I promise you are.</p>\n\n<h2>Okay,</h2>\n\n<p>let’s do something uncomfortable. Try reversing a number:</p>\n\n<pre><code>40.reverse\n</code></pre>\n","load_code":""}, |
10 | 10 | "10":{"lang":"EN","title":"Stop, You're Barking Mad!","chapter":"N","answer":"^\\d{1,}$","ok":"Only strings can be reversed","error":"","text":"<p>You can’t reverse the number forty. I guess you can hold your monitor up to the mirror, but reversing a number just doesn’t make sense.</p>\n\n<p>Ruby has tossed an error message. Ruby is telling you there is no method reverse for numbers.</p>\n\n<p>Maybe if you turn the number into a string first:</p>\n\n<pre><code>40.to_s.reverse\n</code></pre>\n","load_code":""}, |
11 | 11 | "11":{"lang":"EN","title":"Apples are Different From Oranges","chapter":"N","answer":"\\[\\]","ok":"Great, that's an empty list","error":"","text":"<p>And numbers are different from strings.</p>\n\n<p>While you can use methods on any object in Ruby, some methods only work on certain types of things.\nBut you can always convert between different types using Ruby’s “to” methods.</p>\n\n<ul>\n<li><strong>to_s</strong> converts things to <strong>s</strong>trings</li>\n<li><strong>to_i</strong> converts things to <strong>i</strong>ntegers (numbers)</li>\n<li><strong>to_a</strong> converts things to <strong>a</strong>rrays</li>\n</ul>\n\n<p><strong>What are arrays?!</strong></p>\n\n<p>They are lists. Type in a pair of brackets:</p>\n\n<pre><code>[]\n</code></pre>\n","load_code":""}, |
|
0 commit comments