scala - Simple destructuring extractor for command line args -


the preferred approach use similar commented out line below.

  def main(args: array[string]) { //    val (dbpropsfile, tsvfile, dbtable) = args     val dbpropsfile = args(0)     val tsvfile = args(1)     val dbtable = args(2) 

however having little quarrel compiler on it:

error:(13, 9) constructor cannot instantiated expected type;  found   : (t1, t2, t3)  required: array[string]     val (dbpropsfile, tsvfile, dbtable) = args      ^ 

so told should easy few points out there.

use val array(dbpropsfile, tsvfile, dbtable) = args

scala> val array(a,b,c) = array(1,2,3) a: int = 1 b: int = 2 c: int = 3  scala> res0: int = 1 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -