[Swift-user] how to change array index type

Ketan Maheshwari ketan at mcs.anl.gov
Tue Nov 25 09:41:47 CST 2014


Thanks Tim. I did not declare it with float index type. Now corrected and
it works.

On Mon Nov 24 2014 at 9:26:38 PM Tim Armstrong <tim.g.armstrong at gmail.com>
wrote:

> Was fdf_proc_vn declared with [float] as the index type?
>
>
> http://swift-lang.org/guides/trunk/userguide/userguide.html#_associative_arrays
>
> - Tim
> On Mon, Nov 24, 2014 at 8:19 PM, Ketan Maheshwari <ketan at mcs.anl.gov>
> wrote:
>
>> Hi,
>>
>> I need to iterate over a float range between 0.1 and 1.0 with a step size
>> of 0.1.
>>
>> My foreach loop looks like:
>>
>> foreach i in [0.1:1.0:0.1]
>> {
>> /* == generate fdfs for different voltages == */
>> fdf_proc_vn[i]=gen_fdf(i,fdf_proc_v1);
>> }
>>
>> I am getting the following error:
>>
>> Supplied array index type (float) does not match the declared index type
>> (int)
>>
>> How to declare/define array such that it can accept float index type?
>>
>> Thanks,
>> Ketan
>>
>>
>> _______________________________________________
>> Swift-user mailing list
>> Swift-user at ci.uchicago.edu
>> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
>>
> _______________________________________________
> Swift-user mailing list
> Swift-user at ci.uchicago.edu
> https://lists.ci.uchicago.edu/cgi-bin/mailman/listinfo/swift-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/swift-user/attachments/20141125/fe589bec/attachment.html>


More information about the Swift-user mailing list