Skip to content

Instantly share code, notes, and snippets.

@manojpanta
Last active January 16, 2018 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manojpanta/6af12478a405e219c181385180b9d300 to your computer and use it in GitHub Desktop.
Save manojpanta/6af12478a405e219c181385180b9d300 to your computer and use it in GitHub Desktop.
manojpanta_prework.md

DAY1. 1.i couldnt install xcode, appstore says i need osx 10.12.6 or later version. 2.we can open atom from terminal entering atom . 3..rb 4.CMD+/ or tree-view:toggle

6.pwd stands for present working directory . 7.ls lists the files in current folder. cd is to move to other directory.mkdir is to make a new directory. 8.local 9.see comments

DAY2 1.we can simply enter irb into command line to enter irb session 2.**2 Part II 1.puts 2.by typing commands. 3.#indicates a comment. 4."turing".length returns 6 DAY3 *variables

  1. examample:my_variables=10 2.when naming variables we can not use all numbers ,an underscore , a dash, a number at the start. 3.we can change the value of variables by typing the name again with a different value on the command line. *datatypes 1.we can find class of a variable by doing .class at the end. 2.:chop, :chomp, 3.5.to_s converts 5 to string. *strings 1.beacuse we can not perform string interpolation 2.#{} is used for string interpolation. 3..delete('aeiou') *input and output 1.puts is like print used to print out the informetion to the user of a program but print doest make a new line 2.gets pauses program. DAY4 1.intergers are whole numbers where floats are decimal. 2.2**2 Booleans
  • == equal. ** greater or equal. *** smaller or equal. **** not equal ***** && means everything must be true. ****** || means at least one must be true. 2..end_with? , .include? Conditionals 1.if our program makes decision for us then thats called flow control. 2.not many apples 3.if loop body doesn't do anything to make the while condition false, loop will run forever and called infinite loop. we can type ctrl +c to get out of it. NIL 1.nil is a special Ruby data type that means "nothing". SYMBOLS 1.Symbols help Ruby use memory more efficiently 2.no. ARRAYS 1..length can be used to find out number of elemnets in array.
  1. the index of pizza is 0.(probably).
  2. push adds a new element to the end of the array and pop removes (and return) the element at the end of the array Hashes. 1.hashes have keys and values where arrays have elements separated by commas. arrays use square brackets while hashes use curly braces. 2.Arrays are used whenever you need to work with a large group of similar items.but if we want to find an element by using their name than index then we prefer hashes. DAY5 excercise 1. 1."Turing"[0]
  3. .length
  4. .upcase
  5. .delete("n")
  6. a4 = "turing" excercise 2.

3.changes to integer.

Excercise 3.

  1. returns 4 2.dog 3.false
  2. .push("name_of_the_animal") 5.animals.pop

day7 i learned a basic idea of ruby language but im always confused between irb and the normal command line like typing cd ~ on irb.i could not create a game today unfortunately. i spent seven days to finish the work but i feel like i have skipped some parts of prework. i couldnt find the way to start a game. i still have some time until we start day 1 . i will dive into that furthermore for next 7 days. one of the challanging part was typing without looking hopefully that gets better over time.

@manojpanta
Copy link
Author

screen shot 2018-01-10 at 8 01 08 pm

screen shot 2018-01-10 at 8 50 37 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment