This same syntax works with strings and other types. Place the match expression conditions that invoke the same business logic on one line, separated by the | (pipe) character:Ĭase 2 | 4 | 6 | 8 | 10 => println("even") Array to string conversion Error After operation, user password has been changed and no notification has been generated. You have a situation in your Scala code where several match conditions/patterns require that the same business logic be executed, and rather than repeating your business logic for each case, you’d like to use one copy of the business logic for the matching conditions. This is a short PHP guide on how to fix the Array to string conversion error. This is Recipe 3.8, “How to match multiple patterns with one case statement.” Problem This is an excerpt from the 1st Edition of the Scala Cookbook (partially modified for the internet).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |