- Learning Scala Programming
- Vikash Sharma
- 273字
- 2021-06-30 19:07:54
Shaping our Scala Program
A program is a solution specific to a problem. The solution we write is broken down to different tasks. Tasks can be specific to a step or a part of the solution. While coding for such tasks, we use constructs as tools to make them easier, readable, and performant. These tools make it possible to shape up your program at hand.
To code for a task that is repetitive requires either a construct that can repeat a given logic for you, or write the same snippet of code by hand again and again. I bet the first one is far better and that's why we have a few constructs, we call them looping constructs. Scala supports for, while, and do while loops. We'll see how these loops work in Scala. From there, we'll have a quick look at for expressions. We'll also go through the FP (functional programming) way of doing loops through recursion. Then, we'll start taking a look at Scala's conditional statements if and end, with learning how we can shape up program flow using pattern matching. Here's a quick card for what's in there for us in this chapter:
- Looping
- for, while, and do while loops
- The for expressions: a quick go-through
- Recursion
- Conditional statements
- if, and if else
- Pattern matching
- Instant Testing with CasperJS
- Learning PostgreSQL
- Building a Game with Unity and Blender
- Eclipse Plug-in Development:Beginner's Guide(Second Edition)
- Scientific Computing with Scala
- Hands-On Full Stack Development with Go
- Unity UI Cookbook
- R數據科學實戰:工具詳解與案例分析
- Azure Serverless Computing Cookbook
- 從0到1:HTML5 Canvas動畫開發
- 超好玩的Scratch 3.5少兒編程
- Building a Media Center with Raspberry Pi
- 軟件設計模式(Java版)
- Qt 5.12實戰
- C語言程序設計實驗指導