Syntax Error: expected SEMICOLON

Hi Everyone,

I seem to have an issue with this expression, please can anyone assist me with it what's the right way to do this?

#[extra]
#[pallet::benchmark]
fn transfer_increasing_users () {
	// 1_000 is not very much, but this upper bound can be controlled by the CLI.
	let u in 0 .. 1_000;  <- Syntax Error: expected SEMICOLON
	let existential_deposit = T::ExistentialDeposit::get();
	let caller = whitelisted_caller();
}

Any help would be really appreciated.

let ... in is not a valid syntax. What do you want to do with it?

2 Likes

What is it that you're trying to accomplish?

If you want to assign a Range to u, then you should write let u = 0..1_000;

If you want to iterate a thousand times and call that function, then you'd do:

fn transfer_increasing_users () {
	// 1_000 is not very much, but this upper bound can be controlled by the CLI.
	for _u in 0 .. 1_000 {
    	let existential_deposit = T::ExistentialDeposit::get();
	    let caller = whitelisted_caller();
    }
}
1 Like

Thank you for your response!

I'm trying to convert benchmark macros in an existing open source project into attribute macros.

I'm trying to convert benchmark macros into attribute macros.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.