Make while, for and if return values
See original GitHub issueif
is essentially a while
loop that is executed once at most, however return values for if
and while
are inconsistent.
If returns the value of its last statement as its value:
🦄 .editor
// Entering editor mode (^D to finish, ^C to cancel)
if(true) {
let b = 4
}
int ask(if(call(get('true')),block(let('b',4)),block()))
4
However while always returns null:
🦄 .editor
// Entering editor mode (^D to finish, ^C to cancel)
let b = 2
while(b<4) {
b = b+1
}
empty ask(let('b',2),while(call(get('<'),get('b'),4),block(assign('b',call(get('+'),get('b'),1)))))
null
🦄
Issue Analytics
- State:
- Created 3 years ago
- Comments:14
Top Results From Across the Web
Python How to Return value in while loop - Stack Overflow
Simply take your x=str(ser.readline()) x = re.findall("\d+\.\d+", x) x = float(x[0]) return(x) #loop stopped. put it into a function like
Read more >Make while loop test result of function? - Codecademy
Hey guys, I'm trying to figure out how to make my while loop run based off of the result of the function: var...
Read more >Return | Java Loop Statements - EXLskills
It is good practice to always have a return statement after the for/while loop in case the return statement inside the for/while loop...
Read more >Javanotes 9, Section 4.4 -- Return Values
A subroutine that returns a value is called a function. ... function can even be used as the test condition in an if,...
Read more >return - JavaScript - MDN Web Docs - Mozilla
When a return statement is used in a function body, the execution of the function is stopped. If specified, a given value is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
So you’re thinking that
while
should be likereduce
?If I Recall Correctly