-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
You could do
for(_ <- 1 to num) yield e
or the equivalent
(1 to num).map(_ => e)
The '_' here means you don't care about the element of the range, and
aren't giving it a name.
Note that if you have a String, you can repeat it with '*':
scala> val s = "a"
s: String = a
scala> s * 5
res3: String = aaaaa
scala> val s = "xyz"
s: String = xyz
scala> s * 5
res4: String = xyzxyzxyzxyzxyz
That's cute, but not useful very often.
> -- You received this message because you are subscribed to the
> Google Groups "scala-user" group. To unsubscribe from this group
> and stop receiving emails from it, send an email to
>
scala-user+...@googlegroups.com
> <mailto:
scala-user+...@googlegroups.com>. For more options,
> visit
https://groups.google.com/d/optout.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (GNU/Linux)
iEYEARECAAYFAlV2bboACgkQ0GFaTS4nYxtMBACgsraMSGBqotU3AuFLn7W+VTHj
tMgAoLFlqUG+PZAt1RHsluCOqmRDi8cs
=v4kT
-----END PGP SIGNATURE-----