Skip to content

Commit c58fedc

Browse files
Fix range() ranges
1 parent b2ca932 commit c58fedc

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/utils/sprite/builtins/misc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,14 +665,14 @@ pub fn trim(args: &[Value]) -> Result {
665665
pub fn range(args: &[Value]) -> Result {
666666
match args {
667667
[Value::Number(end)] => {
668-
let range: Vec<Value> = (0..=*end as i32).map(|n| Value::Number(n as f32)).collect();
668+
let range: Vec<Value> = (0..*end as i32).map(|n| Value::Number(n as f32)).collect();
669669
Ok(Value::List(range))
670670
}
671671
[Value::Number(start), Value::Number(end)] => {
672672
if start > end {
673673
return Err("range() expects start <= end".to_string());
674674
}
675-
let range: Vec<Value> = (*start as i32..=*end as i32)
675+
let range: Vec<Value> = (*start as i32..*end as i32)
676676
.map(|n| Value::Number(n as f32))
677677
.collect();
678678
Ok(Value::List(range))
@@ -688,7 +688,7 @@ pub fn range(args: &[Value]) -> Result {
688688
if *step == 0.0 {
689689
return Err("range() step cannot be zero".to_string());
690690
}
691-
let range: Vec<Value> = (0..=((end - start) / step).ceil() as i32)
691+
let range: Vec<Value> = (0..((end - start) / step).ceil() as i32)
692692
.map(|n| Value::Number(start + n as f32 * step))
693693
.collect();
694694
Ok(Value::List(range))

0 commit comments

Comments
 (0)