mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-08-06 23:06:49 +02:00
Added some pattern matching
This commit is contained in:
@@ -121,3 +121,25 @@ val text = if (x == 10) "yeah" else "nope"
|
|||||||
|
|
||||||
// Object oriented features
|
// Object oriented features
|
||||||
|
|
||||||
|
class Person
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Case classes
|
||||||
|
|
||||||
|
case class Person(name:String, phoneNumber:String)
|
||||||
|
|
||||||
|
Person("George", "1234") == Person("Kate", "1236")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Pattern matching
|
||||||
|
|
||||||
|
|
||||||
|
// Regular expressions
|
||||||
|
|
||||||
|
|
||||||
|
// Strings
|
||||||
|
|
||||||
|
|
||||||
|
// Input and output
|
Reference in New Issue
Block a user