You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary: return statement is not working on a function
Description. While going through the documentation i was testing the functionalities of mojo, when a function with return statement is called in the main function its giving error: cannot implicitly convert 'Int' value to 'None' in return value error. Updating return to print statement is working well.
Environment details: Mac M1
Mojo Compiler Version: mojo 24.4.0
Operating System version: MacOS Sonoma Version 14.5
Hardware Specifications: 32 GB RAM
Severity/frequency: Low
Steps to reproduce
Include relevant code snippet or link to code that did not work as expected.
return statement
fn sum_values(*values: Int):
var sum: Int = 0
for value in values:
sum += value
return sum
fn main() raises:
var result = sum_values(3,5)
print statement
fn sum_values(*values: Int):
var sum: Int = 0
for value in values:
sum += value
print(sum)
fn main() raises:
var result = sum_values(3,5)
If applicable, add screenshots to help explain the problem.
with return type :
with print statement:
If using the Playground, name the pre-existing notebook that failed and the steps that led to failure.
Include anything else that might help us debug the issue.
System information
- What OS did you do install Mojo on?
MacOS Sonoma Version 14.5
- Provide version information for Mojo by pasting the output of `mojo -v`
mojo 24.4.0
- Provide Modular CLI version by pasting the output of `modular -v`
modular 0.8.0
The text was updated successfully, but these errors were encountered:
Bug description
Summary: return statement is not working on a function
Description. While going through the documentation i was testing the functionalities of mojo, when a function with return statement is called in the main function its giving
error: cannot implicitly convert 'Int' value to 'None' in return value
error. Updating return to print statement is working well.Environment details:
Mac M1
Mojo Compiler Version:
mojo 24.4.0
Operating System version:
MacOS Sonoma Version 14.5
Hardware Specifications:
32 GB RAM
Severity/frequency:
Low
Steps to reproduce
with return type :
with print statement:
System information
The text was updated successfully, but these errors were encountered: