logo-lang


Logo if statement


I am using Logo and I have certain problems while iterating through list.
What is the problem with the line.
if count :L = 0 [stop]
The :L is a list. So, I would like to test the length of list and stop after the list is empty.
You need to wrap the count command in parentheses so that it is evaluated first:
if (count :L) = 0 [stop]
It also wouldn't hurt to add additional parentheses around the entire test and also add the empty brackets for the else clause (if required by your logo interpreter):
if ((count :L) = 0) [stop] []
Bear in mind, stop is used to exit a procedure. If all you want to do is exit out of a loop, you may want to look at other loop structures like a for, while or until loop.

Related Links

Working with lists in LOGO
Logo if statement
Return length of label, in pixels
How to catch command line arguments in Berkley Logo (UCBLogo)?
What are the drawbacks/weaknesses of using LOGO?
Which LOGO implementation? [closed]
How do I move the turtle in LOGO? [closed]
What is the current status of LOGO? (The programming language) [closed]

Categories

HOME
ckan
gsm
process
django-middleware
opacity
collision-detection
python-3.4
ejb-3.0
google-my-business-api
google-search-appliance
osrm
http-status-codes
jetbrains
popup
smooth-scrolling
orange
angular2-pipe
datastax-enterprise
knapsack-problem
stack-trace
dynamic-memory-allocation
git-submodules
r-factor
opencsv
login-required
imdb
zimbra
sdl-2
motherboard
ninja-forms
libzip
python-venv
togglebutton
spring-data-commons
jcs
sharpdevelop
petapoco
multi-select
stripes
racket-student-languages
scikit-image
require-handlebars
skbio
nslocalizedstring
dday
dynamics-nav
ruby-1.8.7
self-join
jain-sip
polarion
tidesdk
conditional-comments
nsnotificationcenter
javacompiler
msdropdown
switchpreference
jsmpp
azure-caching
image-preloader
kernel-density
node-amqp
nop
mahara
lastinsertid
dylan
kohana-orm
mandelbrot
maven-webstart-plugin
infinity.js
pymel
auctex
ntdll
zepto
moonscript
libx264
mysql-connector
visual-leak-detector
zend-validate
method-call
cpack
xslt-grouping
atmega16
wtsapi32
onresize
content-delivery-network
high-load

Resources

Encrypt Message