Author Topic: Alternatives to 'then'  (Read 2253 times)

0 Members and 1 Guest are viewing this topic.

Charles Pegge

  • Guest
Alternatives to 'then'
« on: April 23, 2014, 06:30:40 AM »
In recent releases, a colon can be used instead of 'then'


sys a,b
if a>b then print "yes"  else print "no"


using colons:

if a>b : print "yes" else print "no"
if a>b : print "yes" : else : print "no"


using curly braces:

if a>b {print "yes"} else {print "no"}

Peter

  • Guest
Re: Alternatives to 'then'
« Reply #1 on: April 23, 2014, 07:07:47 AM »
unnecessary, "then" is better for "Basic" feeling.
Beginner will be confused, inclusively me.   ???


jack

  • Guest
Re: Alternatives to 'then'
« Reply #2 on: April 23, 2014, 02:56:46 PM »
I like it, especially the braces version.

JRS

  • Guest
Re: Alternatives to 'then'
« Reply #3 on: April 23, 2014, 04:48:53 PM »
I prefer a tradition BASIC syntax and other variations supported are candy.


Charles Pegge

  • Guest
Re: Alternatives to 'then'
« Reply #4 on: April 24, 2014, 03:20:40 AM »
For consistent grammar with single line conditionals:

if a<b : a+=1

while a<b : a+=1 : wend

for a=1 to 3 : b+=a : next

case 12 : a=b