Criado por Andrei Ilinca
mais de 8 anos atrás
|
||
Questão | Responda |
Int class method: EVEN? Definition + what does it do + and what does it return? | It's a method that control if a given integer is even and it's return true or false..... |
Int class method: ODD? | It's a method that controls if a given integer is even and it's return true or false.... |
Array method: COUNT | arr.count = the return value it's the same as the output (number of el in the array) arr.count(obj) = obj = 7 output and return still the same cioe il numero di volte che l'el obj = 7 si trova nell'arr |
Array method: DELETE | Destructive method delete(obj) = delete all the obj from the arr that are equal to obj and return the last deleted obj. If the obj given does not exits in the arr returns nil. |
Hash method: DELETE | Destructive method hsh.delete(key) = delete the key/value pair from hsh and return the value of the given key, return nil if the given key does not exist in the hsh. |
Hash method: DELETE_IF | Destructive method delete_if {| key, value | block } → hsh Deletes every key-value pair from hsh for which block evaluates to true. If no block is given, an enumerator is returned instead. |
String method: CAPITALIZE | Not a destructive method str.capitalize = uppercase only the first char and all the rest downcase. works only for chars. |
String method: CHARS | Not destructive method str.chars = transform the given str in an array of chars. |
IF/ELSE/ELSIF | if condition == true #execute the first block elsif condition == true #execute this block else #if the above conditions are all false execute this block. |
Ternary operator | Shortcut for if/else condition all in one line condition = true ? execute block : dont execute this block condition = false ? dont execute this block : execute this block |
Quer criar seus próprios Flashcards gratuitos com GoConqr? Saiba mais.