#const function and const block

8 messages · Page 1 of 1 (latest)

tight bough
#
let a = const{

};

and 
pub const fn test()-> Something{}....
sinful matrix
#

a const block is evaluated at compile time and a const function is a function that can be called at compile time

tight bough
#

also can i declare static things from const fn.??

#

like

sinful matrix
#

you can declare static things in any fn

tight bough
#
fn stay_for_ever()->i32{
    static atm:AtomicI32 = AtomicI32::new(0)
    atm.fetch_add(1)// ik this will return old val
}

#

like this as no matter how many time i call this even if i try to update this it will give new value each time