How to create a const variable from function param

I am new to Rust, when i do below, I got a error.

fn test(xx: usize) {
    const yy: usize = xx;
 const yy: usize = xx;
   |     --------          ^^ non-constant value


If you're coming from Javascript, note that const yy = x; in Javascript translates to let yy: usize = xx;, not to a const. (A const in Rust is an item, not a local variable.)

Also, you're probably looking for -- this forum is about changes to the language, not about using it.

1 Like

@scottmcm thanks your response, I will close this, and I create a new How to call asm with function param? - The Rust Programming Language Forum , could you help see if you have solution? thanks.