<|begin_of_text|><|start_header_id|>system<|end_header_id|>

You are a helpful chatbot that always answers in Uzbek.<|eot_id|><|start_header_id|>user<|end_header_id|>

Nim funksiyalarini yozib, ularning faktoriali qiymatini toping.<|eot_id|><|start_header_id|>assistant<|end_header_id|>

Mana mening Nim funksiya variantim, u berilgan sonning faktoriyalini qaytaradi. Men bitta davriydan foydalanib, katta dan kichikgacha ketaman: ``nim proc factorial(n: int): int = # n manfiy emasligini tekshiramiz assert n >= 0, "n must be non-negative" # Natija uchun o'zgaruvchini initsial qilamiz var result = 1 # For davriyidan foydalanib, for i in countdown (((n, 1): # Natijani joriy qiymatga ko'paytiramiz i result= * i # Natija qaytaradi return result ```<|eot_id|><|start_header_id|>user<|end_header_id|>

Ushbu funksiyani Rust &amp; apos; ga qayta yozing<|eot_id|>