https://github.com/sambhav2612/scala
https://github.com/sambhav2612/scala
scala
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sambhav2612/scala
- Owner: sambhav2612
- License: bsd-3-clause
- Created: 2018-05-11T17:42:24.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-11T19:04:25.000Z (about 7 years ago)
- Last Synced: 2025-01-22T01:36:28.491Z (4 months ago)
- Topics: scala
- Language: XSLT
- Size: 142 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# scala
Run scale console by typing `sbt console` to run commands like Python IDLE.
## Data Types
- Int (32-bit)
- Double (64-bit)
- Boolean (t/f)
- String (text)## Notes
- Infix expressions can be used to remove `.` and `()` from compact expressions while keeping the answer and solutions intact throughout. For example:
```scala
1.to(10) == 1 to 10
```- `def` vs `val`: In `val`, the right hand side is evaluated as soon as it is reached upon and the value is referred to instead of variable. However, in `def` each time evaluation is done.
- Functions are defined by sort of Python syntax:
```scala
def myFunction(variableName: dataType) = or : doSomethingHere
```Funtion argumanets are evaluated from left to right.
### Outputs
**Ch #1: Terms and Types:**
```scala
scala> 16.toHexString
res0: String = 10scala> "bar".take(2)
res1: String = bascala> (0 until 10).contains(10)
res2: Boolean = false
```