Commit 89f0a24e
89f0a24ea419Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 8 months ago · 1 file · ~1 modified
Description
Update README with rescue, hash, strings, numeric methods
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Details
- Commit
- 89f0a24ea419
- Parent
- 97d872e765f9
README.mdmodifiedView file
@@ -98,18 +98,29 @@
9898
| Ternary operator | `escape ? 0 : 1` |9999
| `and` / `or` / `not` | boolean operators |100100
| `break`, `next`, `return` | loop/method exit, continue |101+
| **Exception Handling** | |102+
| `begin`/`rescue`/`ensure` | exception handling (setjmp/longjmp) |103+
| `raise` | `raise "error message"` |104+
| `rescue => e` | capture exception message |105+
| `retry` | restart begin block |101106
| **Types & Literals** | |102107
| Integer, Float, Boolean, String, nil | unboxed C types |108+
| Symbol | `:hello` → string constant |103109
| Integer arrays | push/pop/shift/dup/reverse!/each/map/select |110+
| Hash (string→integer) | `h = {}; h["key"] = val; h.each { \|k,v\| }` |104111
| Default parameter values | `def greet(name, greeting = "Hello")` |105112
| **Arithmetic & Operators** | |106-
| Arithmetic, comparison, bitwise | `+`, `-`, `*`, `/`, `%`, `<`, `>`, `==`, `<<`, `\|`, `^` |113+
| Arithmetic, comparison, bitwise | `+`, `-`, `*`, `/`, `%`, `<`, `>`, `==`, `<<`, `\|`, `^`, `**` |107114
| Unary minus | `-b`, `-(expr)` |108115
| `Math.sqrt`, `Math.cos`, `Math.sin` | C math functions |116+
| Integer methods | `abs`, `even?`, `odd?`, `zero?` |117+
| Float methods | `abs`, `ceil`, `floor`, `round` |118+
| **Strings** | |119+
| String literals, interpolation | `"hello #{name}"` → printf |120+
| String methods | `length`, `upcase`, `downcase`, `include?`, `+` |121+
| `Integer#to_s`, `Integer#chr` | number to string conversion |109122
| **I/O** | |110-
| `puts`, `print`, `printf`, `putc`, `p` | stdio calls |111-
| String interpolation | `"P4\n#{size} #{size}"` → printf |112-
| `Integer#chr` | `print byte_acc.chr` → putchar |123+
| `puts`, `print`, `printf`, `putc`, `p` | stdio calls (Int, Float, Bool, String) |113124
| **Other** | |114125
| Parallel/chained assignment | `zr, zi = tr, ti` / `a = b = 0` |115126
| Local variables, constants | `size = 600`, `ITER = 49` |