M
Modular•8mo ago
EzRyder

error: use of unknown declaration '_ZeroStartingRange'

In a Mojo function, how can I use the built in type _ZeroStartingRange as a return type? I received the following code snippet from kapa.ai on Modular's Discord server, but it has the same issue. https://discord.com/channels/1087530497313357884/1119100298456215572/1202422957947879524 I'm currently using Mojo SDK 0.7.0. Thanks!
fn createRange(end: Int) -> _ZeroStartingRange:
return range**end** (end)
fn createRange(end: Int) -> _ZeroStartingRange:
return range**end** (end)
3 Replies
Michael K
Michael K•8mo ago
from builtin.range import _ZeroStartingRange

fn createRange(end: Int) -> _ZeroStartingRange:
return range(end)
from builtin.range import _ZeroStartingRange

fn createRange(end: Int) -> _ZeroStartingRange:
return range(end)
sora
sora•8mo ago
Just use the unary overload of range
EzRyder
EzRyder•8mo ago
Thanks @Michael K! I hoped it was something fairly simple. Still learning! 😀
Want results from more Discord servers?
Add your server